Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it allowed to have line breaks in HTML5 meta's content?

Tags:

html

Given one meta tag as an example:

<meta property="og:description" content="this is just a content">

Is it allowed to have line breaks in that meta's content field?

The reason to ask this is because I like to fill description in Open Graph programmably, which is to extract summary from full content. There would be some line breaks in the extract summary and I'm wondering if it is allowable here.

like image 220
Drake Guan Avatar asked Oct 20 '25 15:10

Drake Guan


1 Answers

Although the idea seems horribly awful to me, I've not found anything in the HTML5 specification that forbids it

https://www.w3.org/TR/html5/document-metadata.html#attr-meta-content

Specifically, for the description property, the specification states: "The value must be a free-form string that describes the page. The value must be appropriate for use in a directory of pages, e.g. in a search engine. There must not be more than one meta element with its name attribute set to the value description per document"

Wich makes me believe that you can insert even HTML inside the content attribute.

like image 108
Bardo Avatar answered Oct 23 '25 05:10

Bardo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!