You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thoughts on replacing the hardcoded document metadata (generic, Open Graph, and Twitter <meta> tags) in the <head> with a plugin/shortcode call which generates meta tags dynamically?
Lines 23-43 in the base layout base.njk are the main tags being replaced but L14-15 and L18-20 also were removed as they would be generated as well.
Proposed Change: Replace the code snippet below, e.g. the hardcoded <meta> tags in document metadata inside base.njk (L23-43) with a plugin/shortcode call.
<metacharset="utf-8"><metahttp-equiv="X-UA-Compatible" content="IE=edge"><metaname="viewport" content="width=device-width, initial-scale=1"><title>Overview—Eleventy, a simpler static site generator.</title><metaname="title" content="Overview—Eleventy, a simpler static site generator."><metaname="description" content="Overview—Eleventy, a simpler static site generator."><!-- Open Graph / Facebook --><metaproperty="og:type" content="website"><metaproperty="og:url" content="https://www.11ty.dev/"><metaproperty="og:site_name" content="Eleventy"><metaproperty="og:locale" content="en_US"><metaproperty="og:title" content="Overview"><metaproperty="og:description" content="A docs page for Eleventy v0.12.1, a simpler static site generator."><metaproperty="og:image" content="https://v1.screenshot.11ty.dev/https%3A%2F%2Fwww.11ty.dev%2Fdocs%2F/opengraph/"><metaproperty="og:image:alt" content="The 11ty logo text with a small floating possum on a balloon"><metaproperty="og:image:width" content="1280"><metaproperty="og:image:height" content="640"><!-- Twitter --><metaproperty="twitter:card" content="summary_large_image"><metaproperty="twitter:site" content="@eleven_ty"><metaproperty="twitter:creator" content="@zachleat"><metaproperty="twitter:url" content="https://www.11ty.dev/"><metaproperty="twitter:title" content="Overview—Eleventy, a simpler static site generator."><metaproperty="twitter:description" content="A docs page for Eleventy v0.12.1, a simpler static site generator."><metaproperty="twitter:image" content="https://v1.screenshot.11ty.dev/https%3A%2F%2Fwww.11ty.dev%2Fdocs%2F/opengraph/"><metaproperty="twitter:image:alt" content="The 11ty logo text with a small floating possum on a balloon"><linkrel="canonical" href="https://www.11ty.dev/">
(Note: Comments were in the initial hardcoded meta tags but can be excluded by removing comments=true as its false by default in the plugin when undefined.)
Utilizing the metagen plugin shrinks the document metadata down a bit, saving 20 lines (which isn't all that big of a deal) but makes the previously hardcoded <meta> tags a bit more dynamic and that is pretty nice. I have a branch with these changes running locally and everything is working nicely but I wanted to wait to submit a PR until we discussed things.
This is not necessarily an issue, just something I wanted to run by you to get your feedback. Thanks! 🎈
Thoughts on replacing the hardcoded document metadata (generic, Open Graph, and Twitter
<meta>
tags) in the<head>
with a plugin/shortcode call which generates meta tags dynamically?Lines 23-43 in the base layout
base.njk
are the main tags being replaced but L14-15 and L18-20 also were removed as they would be generated as well.Proposed Change: Replace the code snippet below, e.g. the hardcoded
<meta>
tags in document metadata insidebase.njk
(L23-43) with a plugin/shortcode call.Instead use a plugin to remove all of the hardcoded
<meta>
tags and generate the tags dynamically producing the same output:output:
(Note: Comments were in the initial hardcoded meta tags but can be excluded by removing
comments=true
as itsfalse
by default in the plugin when undefined.)Utilizing the metagen plugin shrinks the document metadata down a bit, saving 20 lines (which isn't all that big of a deal) but makes the previously hardcoded
<meta>
tags a bit more dynamic and that is pretty nice. I have a branch with these changes running locally and everything is working nicely but I wanted to wait to submit a PR until we discussed things.This is not necessarily an issue, just something I wanted to run by you to get your feedback. Thanks! 🎈
cc @zachleat
The text was updated successfully, but these errors were encountered: