posativ / acrylamid

(unmaintained) static blog generator in python with incremental rendering ⛺
http://posativ.org/acrylamid/
Other
277 stars 40 forks source link

Is there a way to control template elements from post/page metadata? #198

Open brianly opened 10 years ago

brianly commented 10 years ago

I have pages and posts in a site that use different combinations of sidebar items. I can easily do this in templates I have today by using a separate template for each. What I'd like to achieve is a way to do this by specifying a value, or values in the metadata for the page or post. Example: I have a tutorial and want to include reference links in a block on the side. Is there any support for this?

My thinking is that I'd have to create a plugin that looks inside each page as it gets published, and then yank out the value to work with. I'm not sure if this is even possible as I haven't researched extending acrylamid much yet.

posativ commented 10 years ago

Hm, you can use a main template for all posts and then include sidebars etc. in an {% if "foo" in entry.tags %}-clause where you can basically check for all post-related metadata (also works for custom attributes).