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

mention a recommended meta generator tag #1217

Closed
revelt opened this issue May 29, 2020 · 23 comments
Closed

mention a recommended meta generator tag #1217

revelt opened this issue May 29, 2020 · 23 comments

Comments

@revelt
Copy link

revelt commented May 29, 2020

Automated website stack detection tools like wappalyzer currently don't recognise 11ty. The "official" way to recognise the static generator is by <meta generator="x"> tag.

  1. Let's agree on the default, "official" 11ty meta generator tag's value. I propose it to be in format:
<meta name="generator" content="11ty v0.11.0" />

value format being: 11ty + space + v + (semver in x.y.z format)

  1. Once agreed, let's mention this in the documentation and encourage users to put this tag in their markup. Currently we don't have a machine-readable way to tell the world it's built on 11ty.
@brycewray
Copy link

There also is the plugin that @Ryuno-Ki created: https://github.com/Ryuno-Ki/eleventy-plugin-meta-generator. I haven't used it but agree with its spelling out "Eleventy" rather than just "11ty," so as to cover all search possibilities.

On a separate but related subject: would be nice if the version number were exposed in the Eleventy API for just this purpose, for easy insertion in one's <head> partial along the lines of what's being suggested in this issue.

@Ryuno-Ki
Copy link
Contributor

I was about to update my plugin for v0.11.
If @zachleat agrees, I can update its value, no problem.

I just came up with something to make it somehow discoverable.
I pull the number from the package.json of the installed package.

@brycewray
Copy link

brycewray commented May 30, 2020

I was about to update my plugin for v0.11.
If @zachleat agrees, I can update its value, no problem.

I just came up with something to make it somehow discoverable.
I pull the number from the package.json of the installed package.

Any chance you could add some .11ty.js-friendly instructions in the README? 😄

Edit: In the meantime, I added the following to my head.js partial to provide automatic version info:

const jsonInfo = require(`../../../../package.json`)
var eleventyVersion = jsonInfo.devDependencies['@11ty/eleventy']
if (eleventyVersion.charAt(0) == "^") {
  eleventyVersion = eleventyVersion.substring(1)
}

module.exports = function(eleventyConfig) {

  eleventyConfig.addShortcode('headTag', function(data) {

    return `
    <head>
    <meta name="generator" content="Eleventy - 11ty - https://11ty.dev - Version ${eleventyVersion}" />

@Ryuno-Ki
Copy link
Contributor

Sure. Fill an issue at https://github.com/Ryuno-Ki/eleventy-plugin-meta-generator/issues/new so I can keep a reference to it, please.

@brycewray
Copy link

Sure. Fill an issue at https://github.com/Ryuno-Ki/eleventy-plugin-meta-generator/issues/new so I can keep a reference to it, please.

Done. Thanks!

@denisbrodbeck
Copy link

Edit: In the meantime, I added the following to my head.js partial to provide automatic version info:

const jsonInfo = require(`../../../../package.json`)
var eleventyVersion = jsonInfo.devDependencies['@11ty/eleventy']
if (eleventyVersion.charAt(0) == "^") {
  eleventyVersion = eleventyVersion.substring(1)
}

module.exports = function(eleventyConfig) {

  eleventyConfig.addShortcode('headTag', function(data) {

    return `
    <head>
    <meta name="generator" content="Eleventy - 11ty - https://11ty.dev - Version ${eleventyVersion}" />

@brycewray You can require 11ty's version directly with require(@11ty/eleventy/package.json).version.
No version parsing needed 😃

module.exports = function (config) {
  config.addShortcode(`addGenerator`, () => {
    return `<meta name="generator" content="Eleventy - 11ty - https://11ty.dev - v${require(`@11ty/eleventy/package.json`).version}" />`;
  })
}

@brycewray
Copy link

brycewray commented Jun 19, 2020

@brycewray You can require 11ty's version directly with require(@11ty/eleventy/package.json).version.
No version parsing needed 😃

[Slapping own forehead] Ah. Thanks, @denisbrodbeck !

brycewray added a commit to brycewray/eleventy_solo that referenced this issue Jun 19, 2020
@Ryuno-Ki
Copy link
Contributor

Related to #1283

@nhoizey
Copy link
Contributor

nhoizey commented Dec 2, 2020

I'm now using <meta name="generator" content="Eleventy v0.11.1" /> as Zach told us in #1283 that Eleventy is the "software package specifically".

@binyamin
Copy link
Member

binyamin commented Dec 2, 2020

@nhoizey I use that format as well.

Note that if you use the latest (unstable) version of Eleventy from GitHub (ie. with npm install github:11ty/eleventy), you can write v1.0.0-beta.0+sha:<commit-hash> as per the semver spec. Not sure if it's necessary, although you would at least want to distinguish between GitHub and NPM.

@nhoizey
Copy link
Contributor

nhoizey commented Dec 2, 2020

@binyamin you're right, if we use the optional version number, it should be accurate! 👍

brycewray added a commit to brycewray/eleventy_solo that referenced this issue Dec 26, 2020
brycewray added a commit to brycewray/eleventy_solo_starter_njk that referenced this issue Dec 26, 2020
@brycewray
Copy link

brycewray commented Dec 26, 2020

Proving once again that it does pay to look through the documentation (and I’m talking to myself on that one 😄 ), here is a method that works just fine in Nunjucks templates and uses Eleventy’s built-in pkg data value:

<!-- from `head.njk` -->
{% set eleventyVersion = pkg.devDependencies['@11ty/eleventy'] | replace("^", "") %}

  <head>
    <meta name="generator" content="Eleventy v{{ eleventyVersion }}" />

I suspect it would be equally useful, with obvious alterations, in other templating options. Of course, you must change that pkg part to pkg.dependencies if you have Eleventy just plain installed and not --save-dev installed. 😉

@brycewray
Copy link

Note that if you use the latest (unstable) version of Eleventy from GitHub (ie. with npm install github:11ty/eleventy), you can write v1.0.0-beta.0+sha:<commit-hash> as per the semver spec. Not sure if it's necessary, although you would at least want to distinguish between GitHub and NPM.

@binyamin Could you also advise where to find docs (such as they may be) for the beta? Your post here is the first I’ve seen that gives the npm command for obtaining it. Thanks.

@binyamin
Copy link
Member

@brycewray I don't know that they exist, to be honest.

@zachleat
Copy link
Member

zachleat commented Apr 15, 2022

Shipping here, docs already up #2293 (comment)

@zachleat
Copy link
Member

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

Pending addition to eleventy-base-blog here: 11ty/eleventy-base-blog#127

@zachleat zachleat added this to the Eleventy 1.0.1 milestone Apr 15, 2022
@zachleat
Copy link
Member

The small benefit to using the eleventy.generator global data is that we normalize away prerelease version suffixes there

@brycewray
Copy link

brycewray commented Apr 15, 2022

Not yet in 2.0.0-canary.4, correct? Or does it have to be exposed in .eleventy.js somehow?

@pdehaan
Copy link
Contributor

pdehaan commented Apr 15, 2022

@brycewray Looks like this was added today in 089ab8f, but it looks like the latest 2.0.0 is "canary.4" from 2022-03-17:

npm info @11ty/eleventy time --json | grep "canary" | tail -3

  "2.0.0-canary.3": "2022-03-10T22:12:06.738Z",
  "2.0.0-canary.4": "2022-03-17T15:21:10.123Z",
  "1.0.1-canary.4": "2022-04-15T20:57:45.575Z"

UPDATE: OK, disregard, looks like 2.0.0-canary.5 was just pushed:

npm info @11ty/eleventy dist-tags --json
{
  "latest": "1.0.0",
  "beta": "1.0.0-beta.10",
  "canary": "2.0.0-canary.5"
}

npm info @11ty/eleventy time --json | grep "canary" | tail -3
  "2.0.0-canary.4": "2022-03-17T15:21:10.123Z",
  "1.0.1-canary.4": "2022-04-15T20:57:45.575Z",
  "2.0.0-canary.5": "2022-04-15T21:01:55.133Z"

@nhoizey
Copy link
Contributor

nhoizey commented Apr 19, 2022

Looking for meta generator values elsewhere, I saw most don't add a v before the version number.

But I couldn't find any specification about the meta value. 🤷‍♂️

@Ryuno-Ki
Copy link
Contributor

The specification would be https://html.spec.whatwg.org/multipage/semantics.html#meta-generator

The value must be a free-form string that identifies one of the software packages used to generate the document. This value must not be used on pages whose markup is not generated by software, e.g. pages whose markup was written by a user in a text editor.

(Content Warning: Could bring back memories)

@revelt
Copy link
Author

revelt commented Jun 16, 2022

@Ryuno-Ki awesome work! thank you

@djpowers
Copy link

Apologies for bumping an old/closed issue, but since Wappalyzer was specifically highlighted as motivation for this change, I wanted to mention that I submitted a technology suggestion to the Wappalyzer team that was just approved so keep an eye out for that shortly:

The status of your request 'Technology suggestion: Eleventy' has been updated:

Accepted: The technology will be included in the next release. This may take a few weeks.

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

9 participants