Kirbytext linking to page #id anchors

I’ve been searching for the best way to link to sections on a page, but most of the info in the forum is for K2 on this topic.

I did find this article:


…but it wasn’t a full representation on how to do this. Since it is different from the regular markdown method, I figured I’d share the way I have it working, and ask for alternative or simpler methods for clients.

At the top of the page (in the Panel textarea):

Updates: Here's the list of (link: #redesigners text:Redesigners)

And lower in the page:

<h3 id="redesigners">Your 2020 Launch</h3>

I’m sure there’s a programmatic way to do this when rendering full ToCs at the top of the page, but for now, I don’t need all of that.

Using Markdown Extra special attributes would be an option? https://michelf.ca/projects/php-markdown/extra/#spe-attr, probably easier to write for editors than html tag.

As an alternative you could use a Kirbytag for such anker headings.

With an programmatic approach, you would use the sluggified headline text as id attribute, that probably doesn’t work well with the manual approach above.

1 Like