From 407e8753f3c2841e65191dec1adc62a81fd322f6 Mon Sep 17 00:00:00 2001 From: Seirdy Date: Sat, 14 Dec 2024 00:34:50 -0500 Subject: [PATCH] new note: why i choose Microdata --- content/notes/why-i-choose-microdata.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 content/notes/why-i-choose-microdata.md diff --git a/content/notes/why-i-choose-microdata.md b/content/notes/why-i-choose-microdata.md new file mode 100644 index 0000000..fffea55 --- /dev/null +++ b/content/notes/why-i-choose-microdata.md @@ -0,0 +1,10 @@ +--- +title: "Why I choose Microdata" +date: 2024-12-14T00:34:50-05:00 +--- + +The four most popular ways to use RDF-based metadata on websites are RDFa-Core, RDFa-Lite, Microdata, and inline JSON-LD. + +I can't use RDFa-Lite because I need `rel` HTML attributes. [`rel` silently upgrades RDFa-Lite to RDFa-Core](https://www.ctrl.blog/entry/rdfa-link-attributes.html), which parses differently. I doubt all parsers upgrade correctly; some will try to parse RDFa-Core as RDFa-Lite. Conformant RDFa parsers upgrade RDFa-Lite pages to RDFa-Core despite many authors only being familiar with RDFa-Lite. I suppose resources like Schema.org and Google's documentation only documenting RDFa-Lite markup worsens the confusion. + +With RDFa split between two incompatible alternatives with a confusing upgrade mechanism, the alternatives are Microdata and JSON-LD. I use structured data extensively; JSON-LD would duplicate most of the page. Let's use [this relatively short article]({{}}) as an example. [Exruct](https://github.com/scrapinghub/extruct) can convert the embedded Microdata into a massive JSON document featuring JSON-LD. [Take a look at the JSON-LD and HTML side by side](https://paste.sr.ht/~seirdy/7db88ad2405d4ab685130cd513cd9defafd9d2cf). Microdata attributes take a fraction of the footprint, encode the same information, and don't require duplicating nearly the entire page.