Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-01-02, 02:59:19
(This post was last modified: 2013-11-23, 21:22:03 by Carlos.)
This plugin tries to add the title of the current News Manager post to the page <title> tag.
It doesn't require editing template files. It can be an easy way to enhance SEO for sites using NM.
Tested with Innovation, Cardinal, GSkeleton themes. It should work with most standard templates (as long as the <title> tag is located before <?php get_header(); ?>)
It may not work (but shouldn't break anything) with some plugin (maybe some of the I18N family).
Download News Manager Title (Extend) / GitHub
Usage:
Upload news_manager_title.php to your plugins folder.
Make sure it is activated.
By default NM post pages will have then:
Code: <title>Post title - Page title ...</title>
You can change this structure by adding this to your gsconfig.php file:
PHP Code: # Insert post title into/instead of page title. 1 = before, 2 = after, 0 = replace. Default 1. #define("NMTPOSITION",1);
# Text to be used as separator between page title and post title. Default " - " #define("NMTSEPARATOR"," - ");
Examples:
If you don't want the page title, only the post title:
If you want it like this:
Code: <title>Page title: Post title ...</title>
use this:
PHP Code: define("NMTPOSITION",2); define("NMTSEPARATOR",": ");
I've used this couple settings, but I may change them (or add another...) in a future release.
Posts: 21
Threads: 2
Joined: Nov 2012
Carlos, I question whether you can use this to something like the title?
<title> <? php if (return_page_slug () == 'index') {?> <? php get_site_name ();?> <? php} else {?> <? php get_page_clean_title ();?> - <? php get_site_name ();?> <? php}?> </ title>
- I do not want to on the main page to show in the name of the news that is just the <title> in the news but I would like their names.
Thank You.
Posts: 3,491
Threads: 106
Joined: Mar 2010
I'm not sure I understand. Do you mean the page title that is shown in the page content? (inside <h1>...</h1> tags, depending on your template)
Posts: 21
Threads: 2
Joined: Nov 2012
Carlos, I in my theme I have something like that pasted the head:
Code: <title> <? php if (return_page_slug () == 'index') {?> <? php get_site_name ();?> <? php} else {?> <? php get_page_clean_title ();?> - <? php get_site_name ();?> <? php}?> </ title>
- And how do I do now that the title of the news item appeared in <title> page?
I do not want to be named page / subpage on the home page because it is locked in <title>:
<? php get_page_clean_title ();?>
Posts: 3,491
Threads: 106
Joined: Mar 2010
Have you tried this plugin?
Posts: 21
Threads: 2
Joined: Nov 2012
So I enabled this plugin, but at the same <title> have given it does not work. When it works, but then default on the home page I added the title of <h1> in <title> and do not want to
Posts: 3,491
Threads: 106
Joined: Mar 2010
Sorry I don't get it.
1.Tell me if your news page is 'index' or other slug.
2. Let's say your site's name is "Site name", your news page has title "News page" and there's a post with title "Post title". How do you want your index, news, and post <title>'s to be?
Example:
index -> Site name
news -> News page - Site name
post -> Post title - News page - Site name
(This is the way the plugin should be working by default with the template code you have pasted.)
Posts: 1,129
Threads: 137
Joined: Feb 2012
This is really useful. I have a site with a blog for one of my other professions which will get a real SEO boost from this plugin.
I was already using the Custom Title plugin and the two are not incompatible but won't work on the same page so I just made a duplicate page template for the News page, reset the stuff between the <title> tags and everything is fine. - Thanks Carlos.
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-02-12, 05:43:43
(This post was last modified: 2013-02-12, 05:44:17 by Carlos.)
Nice to know it's useful to you.
What version of News Manager are you using? If it's the updated one (after 2.2.4), since 2.3.0 there's another way to set the title tag that can work with other plugins. With the Custom Title plugin it would be a bit different as with GS defaults, but I can tell you a way to do it so that you dont have to duplicate templates.
Posts: 6,266
Threads: 181
Joined: Sep 2011
sidetracking the thread for a second, to get custom titles in core, would you want a tokenized title sitewide or a per page custom title ?
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-02-12, 06:20:47
(This post was last modified: 2013-02-12, 06:34:03 by Carlos.)
Posts: 1,129
Threads: 137
Joined: Feb 2012
(2013-02-12, 05:43:43)Carlos Wrote: What version of News Manager are you using? If it's the updated one (after 2.2.4), since 2.3.0 there's another way to set the title tag that can work with other plugins. With the Custom Title plugin it would be a bit different as with GS defaults, but I can tell you a way to do it so that you dont have to duplicate templates.
I would be interested to know. This is NM 2.2.6 on GS 3.1.2.
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-02-13, 06:23:38
(This post was last modified: 2013-02-13, 06:28:13 by Carlos.)
Posts: 1,247
Threads: 82
Joined: Feb 2011
2013-03-03, 07:53:28
(This post was last modified: 2013-03-03, 07:54:19 by datiswous.)
I tested this plugin both with the Cardinal theme and Emerald2 (modified a bit), but it's not working. Is there some coding I have to implement in the theme file? Because I missed that then.
Here my site: http://gs.wouterb.be/
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-03-03, 08:13:04
(This post was last modified: 2013-03-03, 08:32:38 by Carlos.)
What do you have in your template between <title> and </title> ?
With a non-modified Cardinal template it should work.
I've just checked the Emerald2 theme. To make it work with this plugin you should move the <title>...</title> line and put it before the <?php get_header(); ?> tag. (This plugin expects it to be that way)
Anyway if you're using News Manager 2.3+, instead of using this plugin you could edit your template to use the new nm_post_title tag. See here: http://get-simple.info/forums/showthread...1#pid31721
Posts: 1,247
Threads: 82
Joined: Feb 2011
2013-03-03, 08:50:00
(This post was last modified: 2013-03-03, 09:45:56 by datiswous.)
(2013-03-03, 08:13:04)Carlos Wrote: What do you have in your template between <title> and </title> ?
With a non-modified Cardinal template it should work.
I've just checked the Emerald2 theme. To make it work with this plugin you should move the <title>...</title> line and put it before the <?php get_header(); ?> tag. (This plugin expects it to be that way)
Anyway if you're using News Manager 2.3+, instead of using this plugin you could edit your template to use the new nm_post_title tag. See here: http://get-simple.info/forums/showthread...1#pid31721
Thanks, I'm using version 2.3.2 so it seams I don't need to use the plugin.
Edit:
Ok I will move this to the main thread of News Manager 2.3
Posts: 3,491
Threads: 106
Joined: Mar 2010
Updated to version 0.2.
If using News Manager 2.4+ it will not read the post xml file again to get the post title.
Posts: 206
Threads: 7
Joined: Mar 2013
(2013-11-23, 21:29:02)Carlos Wrote: Updated to version 0.2.
If using News Manager 2.4+ it will not read the post xml file again to get the post title.
I've just discovered this plugin but my title already works so, and all I did for it is just this piece of code in my title
Code: <title><?php nm_post_title() or get_page_clean_title(); ?> | <?php get_site_name(); ?></title>
Is there anything extra that this plugin provides in addition to the code above? I prefer the coding version I use, so I'm just curious if it can offer me some kind of bonus.
Nevertheless, this plugin is great when we think about what this CMS is about - simplicity, and this is exactly it. Thanks for it, this makes more and more people want to use this great (and little at the same time) CMS
Posts: 3,491
Threads: 106
Joined: Mar 2010
I created this plugin before NM 2.3, when function nm_post_title() was not available.
It doesn't provide anything extra - only it can be easier, as you don't need to edit the template.
|