metaformats: Difference between revisions
(link meta backcompat parsing) |
(→parse an element for class microformats: link h-*, set aside parsed head item and append it to end of items array after finishing parsing (prioritize visible data in body)) |
||
Line 25: | Line 25: | ||
** if there is a <code>meta[property=og:type]</code> then | ** if there is a <code>meta[property=og:type]</code> then | ||
*** get that meta element’s <code>content</code> attribute value | *** get that meta element’s <code>content</code> attribute value | ||
*** if it’s "article" then imply a <code>head</code> element root class name of <code>h-entry</code> | *** if it’s "article" then imply a <code>head</code> element root class name of <code>[[h-entry]]</code> | ||
*** if it’s "profile" then imply a <code>head</code> element root class name of <code>h-card</code> | *** if it’s "profile" then imply a <code>head</code> element root class name of <code>[[h-card]]</code> | ||
*** if it's "music" or "video" then imply a <code>head</code> element root class name of <code>h-cite</code> | *** if it's "music" or "video" then imply a <code>head</code> element root class name of <code>[[h-cite]]</code> | ||
** end if | ** end if | ||
** if there is no implied <code>head</code> element root class name and there is a <code>meta[name=twitter:card]</code> then | ** if there is no implied <code>head</code> element root class name and there is a <code>meta[name=twitter:card]</code> then | ||
*** get that meta element’s <code>content</code> attribute value | *** get that meta element’s <code>content</code> attribute value | ||
*** if it's "summary" or "summary_large_image" then imply a <code>head</code> element root class name of <code>h-entry</code> | *** if it's "summary" or "summary_large_image" then imply a <code>head</code> element root class name of <code>[[h-entry]]</code> | ||
** end if | ** end if | ||
** if there is no implied <code>head</code> element root class name and | ** if there is no implied <code>head</code> element root class name and | ||
*** there is a <code>meta[property^=og:]</code> or <code>meta[name^=twitter:]</code> | *** there is a <code>meta[property^=og:]</code> or <code>meta[name^=twitter:]</code> | ||
** then imply a <code>head</code> element root class name of <code>h-entry</code> | ** then imply a <code>head</code> element root class name of <code>[[h-entry]]</code> | ||
** if there is an implied <code>head</code> element root class name | |||
*** set aside the parsed 'item' from that root and its properties | |||
*** after parsing the rest of the document, append that parsed 'item' from the <code>head</code> element to the end of the top level 'items' array | |||
** end if | |||
=== parsing an element for properties === | === parsing an element for properties === |
Revision as of 21:41, 2 April 2022
metaformats is an extension to the microformats2-parsing for parsing invisible data published in HTML meta
tags, both with an explicit methodology, and for backward compatibility with existing vocabularies that have multiple testable interoperable implementations.
- This is a Living Specification that is subject to change as research discovers meta tag vocabularies in wide use and consumed by multiple implementations. Additional implementations are not encouraged at this time. This specification has no stable portions. Features are untested, unless explicitly labeled stable, draft, or proposed, or in stable, draft, or proposed sections. All features are likely to change substantively. While stable features are unexpected, it is a living specification and may eventually document some. When stable features are documented, substantive changes may be proposed by issues and errata filed in response to implementation experience, requiring consensus among participating implementers as part of an explicit to be defined change control process.
- Participate
- Open Issues
- IRC
- License
- Per CC0, to the extent possible under law, the editors have waived all copyright and related or neighboring rights to this work. In addition, as of 2024-11-25, the editors have made this specification available under the Open Web Foundation Agreement Version 1.0.
- Initial publication
- 2022-04-01
algorithm changes
For each of the following subsections, apply the changes therein to the steps in the same subsection in the microformats2-parsing specification.
parse an element for class microformats
Before the step: "if none found, parse child elements …", insert these steps at the same level:
- if none found and the element is a
head
element and there were no root class names found on thehtml
element- parse
meta
elements for backcompat properties (defined in meta backward compatible parsing) - if there is a
meta[property=og:type]
then - end if
- if there is no implied
head
element root class name and there is ameta[name=twitter:card]
then- get that meta element’s
content
attribute value - if it's "summary" or "summary_large_image" then imply a
head
element root class name ofh-entry
- get that meta element’s
- end if
- if there is no implied
head
element root class name and- there is a
meta[property^=og:]
ormeta[name^=twitter:]
- there is a
- then imply a
head
element root class name ofh-entry
- if there is an implied
head
element root class name- set aside the parsed 'item' from that root and its properties
- after parsing the rest of the document, append that parsed 'item' from the
head
element to the end of the top level 'items' array
- end if
- parse
parsing an element for properties
parsing a p- property
insert before "else return the textContent of the element after …":
- else if
meta.p-x[content]
, then return thecontent
attribute
parsing a u- property
insert before "else return the textContent of the element after …":
- else if
meta.u-x[content]
, then get thecontent
attribute
parsing a dt- property
insert before "else return the textContent of the element after …":
- else if
meta.dt-x[content]
, then return thecontent
attribute
meta backward compatible parsing
The following list of meta elements are to be parsed as the listed microformats2 equivalent properties.
- if
meta[property="og:title"]
, parsecontent
attribute asp-name
- else
meta[name="twitter:title"]
, parsecontent
asp-name
- if
meta[property="og:description"]
, parsecontent
asp-summary
- else
meta[name="twitter:description"]
, parsecontent
asp-summary
- if
meta[property="og:image"]
, parsecontent
asu-photo
- else
meta[name="twitter:image"]
, parsecontent
asu-photo
- if
meta[property="og:video"]
, parsecontent
asu-video
- if
meta[property="og:audio"]
, parsecontent
asu-audio
- if
meta[property="article:published_time"]
, parsecontent
asdt-published
- if
meta[property="article:modified_time"]
, parsecontent
asdt-updated
- if
meta[property="article:author"]
, parsecontent
asp-author
Background
The following past work was used to develop this specification: