Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta Generator Shortcode #2293

Closed
zachleat opened this issue Mar 28, 2022 · 5 comments
Closed

Meta Generator Shortcode #2293

zachleat opened this issue Mar 28, 2022 · 5 comments
Assignees

Comments

@zachleat
Copy link
Member

As we move toward making the Leaderboards opt-in via <meta name="generator"> to solve the issue of folks changing their tech stack to another generator (and tanking their scores 😅), we should provide a shortcode to easily automate this.

Name TBD, but here’s how it might work:

<!-- Not real code yet, so don’t use this -->
{% metaGenerator %}
<meta name="generator" content="Eleventy v2.0.0">

or:

<!-- Not real code yet, so don’t use this -->
<meta name="generator" content="{% eleventy.version %}">
<meta name="generator" content="Eleventy v2.0.0">

https://www.11ty.dev/speedlify/

Features:

  • Should strip off canary release suffixes
@zachleat zachleat added this to the Eleventy 1.0.1 milestone Mar 28, 2022
@pdehaan
Copy link
Contributor

pdehaan commented Mar 28, 2022

Big +1 to having both solutions.

  1. I can never remember the exact syntax for <meta> tags since they can sometimes be inconsistent, so a shortcode would be awesome.
  2. There are plenty of times I want to know/display which version of Eleventy I'm running, and using something like eleventy.version is easier than require("@11ty/eleventy/package.json").version and then putting that version in a global data file or using eleventyConfig.addGlobalData("eleventyVersion", require("@11ty/eleventy/package.json").version).

@zachleat zachleat added the needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved. label Mar 28, 2022
@coelmay
Copy link

coelmay commented Mar 28, 2022

I feel {% metaGenerator %} as a shortcode fits perfectly for the intended usage/output.

@nhoizey
Copy link
Contributor

nhoizey commented Mar 29, 2022

I think {% metaGenerator %} is not specific enough, there might be an issue with existing shortcodes.

What about {% eleventyVersionMeta %}?

I also agree with @pdehaan that {% eleventy.version %} (or {% eleventyVersion %}) would be useful.

@zachleat zachleat self-assigned this Apr 15, 2022
@zachleat zachleat removed the needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved. label Apr 15, 2022
@zachleat
Copy link
Member Author

Going with eleventy.version and eleventy.generator Eleventy supplied global data for this one to keep the spirit of full control of markup.

Usage: <meta name="generator" content="{{ eleventy.generator }}">

Docs pending on https://www.11ty.dev/docs/data-eleventy-supplied/#eleventy-variable

@zachleat
Copy link
Member Author

zachleat commented Apr 15, 2022

Shipping with 1.0.1 and 2.0.0-canary.5

zachleat added a commit to 11ty/11ty-website that referenced this issue Apr 15, 2022
zachleat added a commit that referenced this issue Apr 15, 2022
nhoizey added a commit to nhoizey/nicolas-hoizey.com that referenced this issue Apr 19, 2022
nhoizey added a commit to nhoizey/nicolas-hoizey.photo that referenced this issue Apr 19, 2022
AleksandrHovhannisyan added a commit to AleksandrHovhannisyan/aleksandrhovhannisyan.com that referenced this issue Apr 23, 2022
jpoehnelt added a commit to jpoehnelt/blog that referenced this issue Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants