Include a page from another page

I’m struggling to get this working, and want to make sure if this is even possible. I have a section with a bunch of items in it, e.g.:

items/a.md
items/b.md
items/c.md
items/d.md

I want to have an aggregate page (i.e. a markdown file) with a bunch of content, and content that I pull from the items (e.g. I might want to write a paragraph, and then include items/b.md, write some more content and then include items/d.md).

I tried making an include shortcode, and in there call get_page, but it fails with a Function 'get_page' not found error. I then tried using the load_data function, which gives me the raw markdown of the item, but I cannot render it correctly using the markdown filter, as per the documentation, “This doesn’t apply any of the features that Zola adds to Markdown; for example, internal links and shortcodes won’t work.” and my items all use a combination of markdown content and shortcodes.

Any ideas on how I’d get this working without resorting to copy/pasting the items directly into the aggregate page?

get_page can only be used in a template, not in shortcodes because we are still parsing/rendering the pages.

“This doesn’t apply any of the features that Zola adds to Markdown; for example, internal links and shortcodes won’t work.” and my items all use a combination of markdown content and shortcodes.

Internal links should actually work, the docs are outdated.

I don’t think there would be a way to solve your problem since the rendering is happening concurrently and we can’t render shortcodes in load_data etc.

1 Like

Thanks for the detail. I’m now thinking of using a json file to store some of the content - might be blocked by a similar feature as discussed in Generating Pages At Build Time though.

Maybe I can get away with simple markdown in the files (to be able to render it in both places) and some careful templating.

Is this something that could be supported, or is there something fundamental that would block a feature like this?

Nothing fundamental except it would be a bit awkward I think and would feel a bit like a hack.