Created
December 7, 2011 14:56
-
-
Save fideloper/1443103 to your computer and use it in GitHub Desktop.
Example SEO module use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Some embed code in any template --> | |
{embed='site/_header' title='Some Title' keywords='some,keywords' description='a description'} | |
<!-- site.group/_header.html --> | |
<!doctype html> | |
<html> | |
<head> | |
<title>{embed:title}</title> | |
<meta name="keywords" content="{embed:keywords}" /> | |
<meta name="description" content="{embed:description}" /> | |
</head> | |
<!-- So with the SEO module, we can (if we want) pass to the header the title, keywords and description for a given entry --> | |
{embed='site/_header' title='{exp:seo:title entry_id="##"}' keywords='{exp:seo:keywords entry_id="##"}' description='{exp:seo:description entry_id="##"}'} | |
<!-- The trick then, is to get the entry_id available to us. This means the Header embed needs to be inside of an channel entries loop, and is why the module is best used on single entry pages such as a blog article page or a page using the Pages module. Also works nicely with Structure --> | |
{exp:channel:entries channel="blog" limit="1" disable="pagination|member_data|categories"} | |
{embed='site/_header' title='{exp:seo:title entry_id="{entry_id}"}' keywords='{exp:seo:keywords entry_id="{entry_id}"}' description='{exp:seo:description entry_id="{entry_id}"}'} | |
<!-- the rest of the template --> | |
{/exp:channel:entries} | |
{embed='site/_footer'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment