Skip to content

Instantly share code, notes, and snippets.

@speedmax
Created November 17, 2008 01:20
Show Gist options
  • Save speedmax/25625 to your computer and use it in GitHub Desktop.
Save speedmax/25625 to your computer and use it in GitHub Desktop.
// Option 1, flat tags
$page['tags'] = array('soccer', 'cricket betting', 'football');
// get keyword
<meta type="keyword" content="{{ page.tags|join }}"/>
// get list of tag links
{% for tag in page.tags %}
<a href="{{ tag|tag_url }} ">{{ tag }}</a>
{% endfor %}
----------------------------------------------------------------------
// Option 2, tags with attributes
$page['tags'] = array(
array('name'=>'soccer', 'url' => '/tags/soccer')
array('name' => 'a league', 'url' => '/tags/cricket-betting' )
)
// get keyword
<meta type="keyword" content="
{% for tag in page.tags %}
{{ tag.name }} {% if not loop.last %},{% endif %}
{% endfor %}
"/>
// get list of tag links
{% for tag in page.tags %}
<a href="{{ tag.url }} ">{{ tag.name }}</a>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment