Link to DIV ids

Need a way to do links in the structured html editor that allow headings to have a DIV id. Is there a way to do this without making a custom block?

I see there is a way to add custom metas on LINKS but not on anything else correct??

Unfortunately, there isn’t a way to do this in the editor itself. You can add it on the frontend by specifying a custom node renderer for headings: react-datocms/docs/ at master · datocms/react-datocms · GitHub

But then those are auto-generated based on the heading text, and you can’t easily link to them from within the editor itself :frowning:

You can also make a custom plugin to do this, but that’s quite a bit more work.

There’s a previous thread about this with a bit more info: How to add id attribute to paragraph from structured text field? and an outstanding (similar) feature request: Ability to add the id attribute to the paragraph inside the structured text field?

If you need something that works ASAP though, probably the custom node renderer would be the quickest. Sorry we don’t have that built-in! (Edit: Or your custom block idea would work just as well, and give you more flexibility)

Got it. I ended up making my own custom block to do it.

1 Like