Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Include example #1013

Open
AlexHedley opened this issue Jul 1, 2023 · 2 comments
Open

Question: Include example #1013

AlexHedley opened this issue Jul 1, 2023 · 2 comments

Comments

@AlexHedley
Copy link

Do you have examples of the different shortcodes?

I'll like to use the include to create a Table of Contents, once, and use it in other posts.

I created another markdown file toc.md and put it in another directory inputs/includes.

Added the following to my post:

<?# Include "./../includes/posts/toc.md" /?>

But when built the site it added it as raw text not markdown.

Is there another attribute I need to set?

@AlexHedley
Copy link
Author

Should it be

<?! Include "./../includes/posts/toc.md" /?>

https://www.statiq.dev/guide/content-and-data/shortcodes#processing-phases

  • Pre-rendering:

Performed before any other templating engines like Markdown or Razor. That means any output from a shortcode in this phase will be processed by those engines. For example, if you want to include a Markdown document in another Markdown document, you'll need to evaluate the Include shortcode during the pre-rendering phase (otherwise the Markdown processor would have already been run and your included Markdown document would never get processed).

@AlexHedley
Copy link
Author

Alternative

Relative

<?# Markdown ?>
<?!^ "./../includes/posts/toc.md" /?>
<?#/ Markdown ?>

Absolute

<?# Markdown ?>
<?!^ "https://raw.githubusercontent.com/alex-hedley/statiqweb-example/main/src/includes/posts/toc.md" /?>
<?#/ Markdown ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant