Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (updated)
(2015-03-13, 03:23:24)Hypertexter Wrote: There is one Shy additional wish I have since some time: Is there a way in NM 3.1 to add some semantic markup to the posts automatically?

Something like

Code:
<time itemprop="datePublished" datetime="2015-01-07T07:07:21+02:00">January 7, 2015</time>

(in HTML5) would be very helpful for the Google snippet of a post, or some schema.org markup - and it could be made automatically since every post has a date...

And thanks for all your work.

Enter this in Custom Settings:
Code:
DATE_FORMAT <time itemprop="datePublished" datetime="%Y-%m-%dT%H:%M:%S%z">%B %e, %Y</time>
Reply
This looks very nice, thank you.

Is it possible to add a complete markup structure as recommended by schema.org? Like this:

Code:
<body>
<div itemscope itemtype="http://schema.org/NewsArticle">
<span itemprop="datepublished" datetime="2015-03-13T09:55:00+0100">13. März 2015</time></span>  
<span itemprop="name">Name of the Article</span>
by <span itemprop="author">Johnny Authorname</span>
  <span itemprop="articleBody">Text of the Article... blabla.</span>
</div>
</body>
Reply
I'm afraid it's not currently possible. It will be when some kind of custom post templating is implemented (in a future version).
Reply
Russian forum user Алексей found an issue with nm_search() template tag: case-insensitive search does not work with non latin, multibyte character sets (e.g. cyrillic). This will be fixed in the next release.

If you need a fix now, you can replace news_manager/inc/site.php with this modified version:
https://raw.githubusercontent.com/cnb/Ne...c/site.php
(note: only valid for News Manager 3.1)
Reply
Hello Carlos,

today I tried to make a recent list with a custom template and filtered by a tag. I found "nm_custom_display_recent" for that task, and it works, but: I need to use "margin-bottom:0", since it produces an own <ul> for every line, and an empty line after each entry. (I want to have the standard ul-li look)

Could this be done more elegant?

My code is:
PHP Code:
<?php nm_custom_display_recent('<ul style="margin-bottom:0" class="nm_recent"><li><a href="{{ post_link }}" 
target="_blank">{{ post_title }}</a><span class=nm_post_date>&nbsp;am {{ post_date }}</span></li></ul>'

'Tagname');?>
Reply
Put your <ul> and </ul> tags outside the function, like this:

PHP Code:
<ul style="margin-bottom:0" class="nm_recent">
<?
php nm_custom_display_recent('<li><a href="{{ post_link }}" 
target="_blank">{{ post_title }}</a><span class="nm_post_date">&nbsp;am {{ post_date }}</span></li>'

'Tagname'); ?>
</ul> 
Reply
Lightbulb 
Of course...Idea

Thank you!
Reply
Hello,

I found something special when (News Manager language is "de_DE" and) the post date is inserted in a custom way, like:

PHP Code:
<?php nm_custom_display_recent('<li><a href="{{ post_link }}" 
target="_blank">{{ post_title }}</a><span class="nm_post_date">&nbsp;am&nbsp;{{ post_date }}</span></li>'

'Tagname'); ?>

or via "nm_custom_list_recent" in the same way:

Dates with 1-digit day numbers get an extra white space before the day number, which is not nice for line breaks sometimes, for example: "(title text) am _3. Dezember 2014"

Hypertexter
Reply
That's how PHP's strftime function (used by NM for localised dates) works.

I could patch the plugin to remove that leading space in 1-digit days, but...

What if you change the &nbsp; before {{ post_date }} by a normal space? Like:
PHP Code:
...<span class="nm_post_date">&nbsp;am {{ post_date }}</span>... 
Reply
Hm... I see! A normal white space and the leading white space result in one white space...

I wanted to avoid a date as the beginning of a new line on mobile devices, but never mind.

Thank you
Hypertexter


Exclamation I found this:
http://stackoverflow.com/questions/90492...-leading-0

and tried:
DATE_FORMAT <time itemprop="datePublished" datetime="%Y-%m-%dT%H:%M:%S%z">%-e.&nbsp;%B %Y</time>

and it seems to work on my server Smile
Reply
Very interesting. So with a dash after the "%" you can remove the padding (spaces or zeroes) in any numeric modifier. It seems it's a (nonstandard) GNU extension for strftime.
Nice to know - Thanks for sharing!
Reply
Hello Carlos,

I tried to add author information to my posts, but I failed.

I added "define('NMSAVEAUTHOR', true);" to the gsconfig.php and "showAuthor 1" to the custom settings of NM, but nothing happens.

Do I need something else in NM 3.1?

And when it works, will it make a meta information like "<author>John</author>", HTML5-like?

Thanks,
Hypertexter
Reply
(2015-03-20, 05:18:35)Hypertexter Wrote: I tried to add author information to my posts, but I failed.

I added "define('NMSAVEAUTHOR', true);" to the gsconfig.php and "showAuthor 1" to the custom settings of NM, but nothing happens.

Existing posts (created before you enabled NMSAVEAUTHOR) don't have an author.
Either re-edit and save them again, or define a default author for those posts in Custom Settings:
Code:
defaultAuthor John

(2015-03-20, 05:18:35)Hypertexter Wrote: And when it works, will it make a meta information like "<author>John</author>", HTML5-like?

No, it will make something like this:
Code:
<p class="nm_post_author">Author: <em>John</em></p>

You can customize the markup for the author field container (default is p) with custom setting markupPostAuthor, however the author name will still be enclosed between <em>...</em> tags (currently hardcoded in the plugin).

(Again, this will be more customizable when support for post templating is implemented...)

I suppose that for 3.2 I can add another custom setting that allows changing that <em> by the markup of your choice...
Reply
(2015-03-20, 06:14:37)Carlos Wrote:
(2015-03-20, 05:18:35)Hypertexter Wrote: And when it works, will it make a meta information like "<author>John</author>", HTML5-like?
[...]
I suppose that for 3.2 I can add another custom setting that allows changing that <em> by the markup of your choice...

Done (in the dev version). If you want to use this new custom setting in NM 3.1, just replace news_manager/inc/site.php by this version and enter this in Custom Settings:
Code:
markupPostAuthorName author
(to use <author> instead of <em>)
Reply
Hello Carlos,

nice, thank you!

Can I use defaultAuthor in custom setting and nmauthor in gsconfig.php at the same time?

By the way: Perhaps I found an easter egg:
I wanted to comment my various custom settings and found an effect. The custom setting
Code:
markupPostDate span /itemprop="trial"
leads to HTML:
Code:
<span itemprop="trial" class="nm_post_date">...</span>
Rolleyes

Is that a feature? LOL

Bye
Hypertexter
Reply
(2015-03-23, 00:32:41)Hypertexter Wrote: Can I use defaultAuthor in custom setting and nmauthor in gsconfig.php at the same time?

Yes, you should be able to.

(2015-03-23, 00:32:41)Hypertexter Wrote: By the way: Perhaps I found an easter egg:
I wanted to comment my various custom settings and found an effect. The custom setting
Code:
markupPostDate span /itemprop="trial"
leads to HTML:
Code:
<span itemprop="trial" class="nm_post_date">...</span>
Rolleyes

Is that a feature? LOL

Doesn't work for me - I get bad markup instead.

Only lines beginning with # or // are interpreted as comments (that is, ignored). You cannot add comments to a custom setting.
Reply
Hello,

for better usability I would like to redirect user-shortened NM urls with these rules in .htaccess:

RewriteRule ^/blog/tag http://www.domain.de/blog [R=301,L]
RewriteRule ^/blog/post http://www.domain.de/blog [R=301,L]

But they don't work. The other NM rules work fine:
RewriteRule ^blog/tag/([^/.]+)/page/([^/.]+)/?$ index.php?id=blog&tag=$1&page=$2 [L]
RewriteRule ^blog/tag/([^/.]+)/?$ index.php?id=blog&tag=$1 [L]
RewriteRule ^blog/post/([^/.]+)/?$ index.php?id=blog&post=$1 [L]
RewriteRule ^blog/page/([^/.]+)/?$ index.php?id=blog&page=$1 [L]
RewriteRule ^blog/archive/([^/.]+)/?$ index.php?id=blog&archive=$1 [L]

What can I do?
(I use fancy urls in GS with %parent%/%slug%)

Thanks
Hypertexter
Reply
I don't know much about .htaccess stuff, but this seems to work for me:

Code:
RewriteRule ^blog/tag/?$ http://www.domain.de/blog [R=301,L]
RewriteRule ^blog/post/?$ http://www.domain.de/blog [R=301,L]
(just after the RewriteBase line, before the other rules)
Reply
Why put domain names in rewrites?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
@Carlos: That works for me, too, thank you!

@shawn_a: I don't know, somebody showed me to do it like this and it worked... but you are right, the simple word "blog" does the same job Idea
I did not know.

Bye
Hypertexter
Reply
Great plugin, but having an issue I can't quite figure out.

Clean install, "Grill" Theme. Deleted the sample news posts and entered a new one. Great! Shows in the sidebar and the news page. Entered a second post...doesn't show!

Deleted and retried, still does not show on either the sidebar or the news page. Post is not marked private and all tags are identical to post that shows properly.

Any ideas?
Reply
Did you create that second post using NM's backend, or by copying/uploading it to data/posts?

If you tell me (by PM if you prefer) your site's URL, I can take a look at it and maybe come up with some idea...
Reply
Good plugin.

Any plans to support Markdown ? Once you go Markdown you never go back to wysiwyg.
Reply
Thank you.

Yes, I intend to support Markdown. Maybe integrating News Manager with this plugin in some way.
Reply
Thats cool. I use that plugin also and it functions great.
Reply




Users browsing this thread: 2 Guest(s)