Kye
Kye

Reputation: 6289

How to include meta data in HTML tags

I plan to use a headless-CMS to manage content on my website, so a non-technical content editor will be able to independently maintain content.

To assist the content editor map content between the website and the CMS, I need to inject a CMS ID into HTML tags. (thinking that the content editor will view the page source to find the value)

What is the standard way to inject meta data into a HTML tag?

E.g. <p cms-id=7adQpNPZxP4jK28RLp3wES></p>

Upvotes: 3

Views: 1284

Answers (2)

catchergeese
catchergeese

Reputation: 732

You can use data- attributes on elements. See Mozilla: Using data attributes for usage.

It doesn't interfere with HTML semantics and is easily accessible with JavaScript.

Upvotes: 6

juanforce
juanforce

Reputation: 61

The <meta> tag defines metadata about an HTML document. Metadata is information about data.

<meta> tags always go inside the <head> element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings.

Upvotes: 0

Related Questions