-
Notifications
You must be signed in to change notification settings - Fork 246
Misc Tweaks
A collection of things that are short enough that don’t need their own page. (if you want to expand on them in separate page, go ahead!)
In your templates, Toto exposes the markdown
method, so you can parse markdown in any text or metadata. A common use case is parsing markdown in the title of your post, which Toto doesn’t do by default. To do so, add <%= markdown article.title %>
to your template.
Metadata is no different than the other attributes of your articles, such as the date
, title
, or author
. So adding your own metadata is simply a matter of adding some extra attributes to the article YAML headers.
In the article templates, you can usually access the extra YAML information just like any other property of your article. For instance, to list all the tags a post may have (presuming they are space seperated) you can use:
<% article[:tags].split.each do |tag| %>
<a href="/tags/<%= tag %>"><%= tag %></a>
<% end %>
This presumes you added something like
tags: foo bar baz
to your article.
Article metadata is available via the @context
variable, when not in the article templates. This is useful for adding <meta>
tags in your <head>
, with article information.