on
SEO Lite v1.1
I just pushed a new version of SEO Lite to github and it has some added goodies, among other things these parameters:
Parameters
- url_title; retrieve by url_title (often found as a url segment)
- entry_id; retrieve by entry_id
- use_last_segment = ‘yes’; pure magic! (it will use the last segment, this is useful if you have the same header all over the website and you sometimes need to use {segment_2} and sometimes {segment_3}
- default_title – set the title tag directly (ie. do not get from content) – useful for static pages, main page, etc.
- default_description – override the description – same as above
- default_keywords – override the keywords – same as above
- title_prefix – a string to prefix the title with (per request)
- title_postfix – a string to postfix the title with (per request)
- title_separator – this will be added after the title (and padded with space on both sides)
Some Usage Examples
Let’s use this template:
<title>{title}{site_name}</title> <meta name='keywords' content='{meta_keywords}' /> <meta name='description' content='{meta_description}' /> <!-- generated by seo_lite --!>
yeah I know the {title} and {site_name} are pretty close there, but we’ll fix that with the new _titleseparator parameter :-)
Frontpage
For the frontpage we just want the site name + the default keywords / description:
{exp:seo_lite}
Will produce this title:
<title>My Site Name</title> (... + default desc / keywords ...)
Our 404 Page
{exp:seo_lite default_title="404 - Not Found" title_separator="|"}
produces:
<title>404 - Not Found | My Site Name</title> (... + default desc / keywords ...)
A FAQ Entry
{exp:seo_lite entry_id="{entry_id}" title_postfix=" | FAQ" title_separator="|"}
will produce this title for a specific faq entry:
<title>A Question | FAQ | My Site Name</title>
note that the is needed because EE will trim parameters for spaces.
Using SEO Lite with the EllisLab Discussion Forum Module
Edit the forum_global/html_header.html file and replace the title-tag there with:
{exp:seo_lite default_title="{page_title} | {forum_name}" title_separator="|"}
It will output:
<title>The title of the current forum or thread here | Forum Title Here | My Site Name</title>
Of coure you need to run the forums through regular templates for the above to work, but that’s something I’d always recommend doing, unless you enjoy pain.
Implementing SEO Lite in the wiki
Edit wiki_themes/
{exp:seo_lite default_title="{title} | {wiki_name}" title_separator="|"}
It will output:
<title>The title of the current wiki page | Wiki Name Here | My Site Name</title>
Of course for the wiki / forum pages you’ll just get the benefit of keeping it consistent and getting the default keywords / description in there, since there isn’t a way of adding entry-specific keywords/description for these entries (yet)..
MSM Support
I got a couple of comments about MSN support, and although it’s untested I think I’ve implemented support for it. The way it works is that you need an entry in exp_seolite_config for each site, so when you switch to another site you need to visit the SEO Lite control panel and an entry will be added for that site. Then you can start using SEO Lite on that additional site as well.
This way you can have different templates for each site etc.
Suggestions?
Let me know if you have suggestions to added functionality or something you’ve found quirky when implementing it on a site, etc.
Download
Download the latest release here (zip)
Comments
Comment by Bob on 2012-04-28 19:16:43 +0000
Greetings,
This is a very helpful add-on for adding basic SEO to a site, much better than hand-coding it myself. I had one question. Is there a good way to use this on Category pages? Basically it seems the way I’m doing it now just uses the default SEO tags for all category pages. Likely a similar thing would happen with paginated entries.
Thanks, Bob
Comment by Bjørn Børresen on 2012-04-29 11:02:19 +0000
Hey Bob,
currently there’s no support for category pages – but I have been pondering a solution where the category description is pulled from EE (as you probably know the Category Field Group has a description field) together with the Category name for title.