Webflow sync, pageviews & more.
NEW

How can I add an ID to content within the post body (RTF) in Webflow for easy external linking?

TL;DR
  • Use the Embed component in the Rich Text Field to insert HTML elements with unique ID attributes like <h2 id="section-1">Title</h2>.
  • Link to those sections using page-url#section-1 in your site, or use JavaScript to auto-generate IDs for headings if needed.

To enable external linking to specific sections inside a Rich Text Field (RTF) in Webflow, you need to add custom ID attributes to elements within the RTF content. Webflow’s native tools don’t support ID assignment directly inside CMS Rich Text, but here’s how to do it using custom code and/or the Embed component.

1. Use the Embed Element in the RTF

  • In the CMS, while editing the Rich Text content, click the + button and choose "Embed".
  • Paste HTML with your preferred element and ID. For example:
  • <h2 id="section-1">My Section Title</h2>
  • This creates an anchor to which you can link like yourpage.com/post#section-1.

2. Add IDs Manually in Structured HTML

  • Use the Embed method to add tags like:
  • <div id="my-anchor">Content here</div>
  • <a id="jump-here"></a> before a block or heading.
  • Add headings (h2, h3, etc.) or paragraphs with IDs as needed.
  • Anywhere on your site, create a link with the URL:
  • https://yourdomain.com/post-slug#my-anchor
  • This will jump directly to the part of the RTF content with the matching ID.

4. Enable Custom Attributes via JavaScript (Advanced Option)

  • If you prefer automatic IDs for all headings, custom JavaScript can be injected in the Page Settings > Custom Code to loop through the RTF content and assign IDs based on heading text.
  • Example usage: scan .w-richtext h2 and set id attributes dynamically (requires coding knowledge).

Summary

To link to specific parts inside a Rich Text Field in Webflow, use the Embed component within the RTF to insert HTML elements with unique ID attributes, then link to them using #id-name in the URL. This allows precise in-page navigation even inside dynamic CMS posts.

Rate this answer

Other Webflow Questions