You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

linking.md 1.6KB

123456789101112131415161718192021222324252627282930313233343536
  1. +++
  2. title = "Internal links & deep linking"
  3. weight = 50
  4. +++
  5. ## Header id and anchor insertion
  6. While rendering the markdown content, a unique id will automatically be assigned to each header. This id is created
  7. by converting the header text to a [slug](https://en.wikipedia.org/wiki/Semantic_URL#Slug), appending numbers at the end
  8. if the slug already exists for that article. For example:
  9. ```md
  10. # Something exciting! <- something-exciting
  11. ## Example code <- example-code
  12. # Something else <- something-else
  13. ## Example code <- example-code-1
  14. ```
  15. ## Anchor insertion
  16. It is possible to have Zola automatically insert anchor links next to the header, as you can see on the site you are currently
  17. reading if you hover a title.
  18. This option is set at the section level: the `insert_anchor_links` variable on the
  19. [Section front-matter page](./documentation/content/section.md#front-matter).
  20. The default template is very basic and will need CSS tweaks in your project to look decent.
  21. If you want to change the anchor template, it can easily be overwritten by
  22. creating a `anchor-link.html` file in the `templates` directory.
  23. ## Internal links
  24. Linking to other pages and their headers is so common that Zola adds a
  25. special syntax to Markdown links to handle them: start the link with `./` and point to the `.md` file you want
  26. to link to. The path to the file starts from the `content` directory.
  27. For example, linking to a file located at `content/pages/about.md` would be `[my link](./pages/about.md)`.
  28. You can still link to a header directly: `[my link](./pages/about.md#example)` will work as expected.