acrylamid icon indicating copy to clipboard operation
acrylamid copied to clipboard

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

Open brianly opened this issue 11 years ago • 1 comments

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.

brianly avatar Jan 06 '14 15:01 brianly

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).

posativ avatar Jan 06 '14 16:01 posativ