# Anchor link at template level

**URL:** <https://zola.discourse.group/t/anchor-link-at-template-level/2373>\
**Category:** Feature requests\
**Created:** [November 12, 2024, 10:37am UTC](https://zola.discourse.group/t/anchor-link-at-template-level/2373 "2024-11-12T10:37:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HugoTrentesaux](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/hugotrentesaux/32/105_2.png) [@HugoTrentesaux](https://zola.discourse.group/u/HugoTrentesaux)\
**Post date:** [November 12, 2024, 10:37am UTC](https://zola.discourse.group/t/anchor-link-at-template-level/2373/1 "2024-11-12T10:37:33Z")

</div>

I read [Why are anchor links not available to pages?](https://zola.discourse.group/t/why-are-anchor-links-not-available-to-pages/1752).  
I know it’s again [Section vs Page](https://zola.discourse.group/t/section-vs-page/522).  
I still would like to express the need for this feature ([doc](https://www.getzola.org/documentation/content/linking/#anchor-insertion)) at the template level. When making a generic theme aiming to be used by someone else, I feel like it’s more appropriate to tell

> set `template = "example.html"` in your front matter, the template will take care of your content

than

> set `insert_anchor_links = "heading"` in your front matter, but only for sections that use `example.html` template, and `insert_anchor_links = "right"` for others that use the `page.html` default for their pages

It’s the same kind of thing as having the user insert `[TOC]` at the position where he wants the table of content to be inserted, while a macro called by the template takes care of this.

I feel like these things belong more to templating than content metadata, and so the current way of specifying this makes writing content-independent theme cumbersome.

In concrete terms, it could mean to have an `insert_anchor_links` filter, but that’s maybe a too big task for a filter.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [November 12, 2024, 12:34pm UTC](https://zola.discourse.group/t/anchor-link-at-template-level/2373/2 "2024-11-12T12:34:00Z")

</div>

> In concrete terms, it could mean to have an `insert_anchor_links` filter, but that’s maybe a too big task for a filter.

If you do it in the template, you need to parse HTML and edit it. It also means the content will be different if you get it later with get\_section/get\_page compared to its own page
