Adding a "footer" to posts?
It's not really a footer, but what would be the best way to automatically attach some links at the bottom of posts, I know I can add to entry template... but I was wondering If I could do this per tag? So certain tags get the attached.
Yes, you can do it like this using tags in entry.html
{{#entry}}
...
{{#tagged.apple}}
FOOTER TEXT FOR POSTS TAGGED APPLE
{{/tagged.apple}}
...
{{/entry}}
You can even store this text inside your folder, and dynamically reference it, e.g.
{{#tagged.apple}}
{{> /Pages/Footers/apple.txt}}
{{/tagged.apple}}
And in /Pages/Footers/apple.txt add the following metadata to hide the page from your site:
Menu: no
FOOTER TEXT FOR POSTS TAGGED APPLE
Please let me know if you have any questions about this or anything else
Works great, thanks!
Is there a way to do this for all posts (as opposed to pages)? I'd like my posts to have a footer (with date/subscribe/etc info) but not my pages, and both are structured by entry.html. My current workaround is to add one tag to every post and target that tag with but if there's a more elegant way I'd change it.
Absolutely, this is how you'd add footers for posts or pages specifically:
{{#entry}}
...
{{^page}}
FOOTER TEXT FOR POSTS ONLY
{{/page}}
{{#page}}
FOOTER TEXT FOR PAGES ONLY
{{/page}}
...
{{/entry}}
Do pages (those that have a date set in metadata) support the {{date}} attribute, or is that only for posts?
Pages do not the {{date}} attribute, however, you can work around this using the formatDate function:
{{#formatDate}}MMMM Do, YYYY{{/formatDate}}
See the available date tokens for the various formats in the developer reference.