Include `macro` in content


I have a content page where I currently call a shortcode that renders some data.
Now I want to generate links to other pages based on the path for this I would need to use the get_page function which is not available in shortcodes the documentation says that the alternative is a macro but I don’t know how to load a macro from my markdown file in content.

Can someone help me or point me into another direction.
What I want to achieve is to link to another page. I have the relative_path to the page and need to generate a link with the page.title.

Thanks a lot.


Just bumping this question. I stumble about the same problem.

I want to include a project list from a directory in between content pieces:

# some markdown
{{ projectlist() }}
# some more markdown

Shortcodes don’t work and I can’t figure out how to include macros in the markdown file.

Any help would be appreciated!

1 Like

You can’t include macros in the markdown files. What do you mean shortcodes don’t work?

1 Like

Shortcodes technically work for me, but for this use-case I cannot use them as they would need to support get_section:
I try to iterate over all projects in a folder (content / projects / project 1…5 / and retrieve the project’s title/date/etc. This list should then be embedded in the middle of regular content.
Similar to:
‘hi, here are some projects’
{{ projectlist }} ← this is the impossible shortcode with get_section
‘thanks for checking them out’

I think the confusion comes from the documentation, where macros are mentioned as alternative to shortcodes. After taking a second look, I realized that the docs also clearly say that macros are called from templates – sorry.

The original problem remains: how can one integrate automatically retrieved content from pages surrounded by regular markdown content?
Is there another way of doing this that won’t require get_section?

1 Like

I found a workaround to use macros in markdown:

  • define a string that will be replaced (example [TOC] or [GALLERY])
  • define a macro that replace the string by a macro call
  • wrap your content in the replacement macro

You have examples in my seagull theme: