Your sites Log in Sign up Menu

Insert block in page

I’m looking to avoid repeating a specific block of code from within the individual post entries. Within a theme, this would be achieved using {{> Block}}.

Is there a way to do this within a post. Currently Blot hides this code. Do I need to put a path? {{> /templates/theme-name/Block }} or something similar?


2 years ago, 3 replies   Improve this question

This would be useful to me as well.

Answered 2 years ago · Improve this answer

This is not possible at the moment – right now, entries are treated as static and are not evaluated dynamically like template views. Can I ask what you're trying to repeat more specifically?

If you want to add something either before or after some set of posts, you could use custom metadata like so in your post:

preamble: yes

And like so in your template's entry.html file:

{{#entry}}
{{#metadata.preamble}}
<p>This content will be repeated/shown for all posts with the preable metadata.</p>
{{/metadata.preamble}}

{{{html}}}

...
{{/entry}}
Answered 2 years ago · Improve this answer

Not the OP.

The way this would be useful for me is to have something like a php include. In my case, I have a listing of faculty contact info that is used at various places in the site. It would be nice to do something like include("faculty-contact.txt").

Answered 2 years ago · Improve this answer