Doing get_page in shortcodes make an error

I am flummoxed by this error. I can do

{% set z = get_page(path="blog/x.md") %}

on a my blog_page.html template, but when I do it inside a shortcode, I get

Error: Reason: Failed to render 'shortcodes/link.html'
Error: Reason: Function 'get_page' not found

however, I can do

{% set w = get_url(path="blog/x.md") %}

in a shortcode

I know I am missing something very dumb,

(I am porting from Jekyll and it has this command ({% post_url markdown_file %}) which I need to replace with a shortcode, and need get_page to get title) )

best, j

Not all functions are available in shortcodes. I think it’s mentioned somewhere in the docs but I can’t find it. In that case, we are still processing pages in parallel so you can’t access the other pages since we might not have it yet.

1 Like

Thanks @keats

Good to know what is the cause. This is a bit annoying as my md are full of those (how one links blogs together, and is a nice Jekyll feature). I’ll add this to the python code converting the Jekyll md to Zola md, and my python pre-process of md to zola.

best, j

Use the Zola specific link style then: [my other page](@/blog/my/other/page.md) which will be automatically set up correctly and will detect broken links

2 Likes

Thanks @keats

Works perfectly.

Thanks for answering all the dumb questions.

best, j