Jekyll: including a post inside another post


I saw Kevin’s response on stackoverflow to the ‘Jekyll: including a post inside another post’ question’.

This worked for me. However logic statements in the post that’s being loaded into the post are not being parsed rather than displayed as plain text:

The “{% include carousel.html height=”75” unit=”%” duration=”7” number=”3” %}” line is supposed to be parsed into a picture carousel.

Not sure how to fix this.



1 Like

If anyone’s curious, here’s the Stack Overflow question:

This is a fun question, but unfortunately I haven’t figured out a way to do this.

If it helps your searching, I think you’re looking for a way to get the rendered content of a page or post. Jekyll’s docs say that content is “rendered or un-rendered depending upon what Liquid is being processed and what page is” which isn’t super helpful. If you could find a way to get the rendered content, that would get you where you need to be.

Alternatively, you might do this with JavaScript instead. You could call the fetch() function to get the content of your second page.

Here’s a tutorial on the fetch() function if it helps: