This package has been deprecated

Author message:

Deprecated. Use eleventy.generator instead https://www.11ty.dev/docs/data-eleventy-supplied/#eleventy-variable

eleventy-plugin-meta-generator

0.3.1 • Public • Published

eleventy-plugin-meta-generator

Known Vulnerabilities

⚠️ Deprecated. Please use eleventy.generator instead (available 1.0.1 and higher) ⚠️

Adds a meta-generator tag to the head of the generated html files

Installation

That's simple!

npm install eleventy-plugin-meta-generator

Usage

Update your .eleventy.js like so:

// For liquid
const generator = require('eleventy-plugin-meta-generator');

module.exports = function (eleventyConfig) {
  eleventyConfig.addLiquidTag("generator", () => {
    return {
      render: function() {
        return generator()
      }
    };
  });

  return {
    templateFormats: [
      'liquid'
    ]
  };
};
const generator = require('eleventy-plugin-meta-generator');

module.exports = function (eleventyConfig) {
  eleventyConfig.addNunjucksTag("generator", (nunjucksEngine) => {
    return new function() {
      this.tags = ["generator"];

      this.parse = function(parser, nodes, lexer) {
        var tok = parser.nextToken();

        var args = parser.parseSignature(null, true);
        parser.advanceAfterBlockEnd(tok.value);

        return new nodes.CallExtensionAsync(this, "run", args);
      };

      this.run = function(_, myStringArg, callback) {
	generator()
	  .then((metaTag) => {
	    let ret = new nunjucksEngine.runtime.SafeString(metaTag);
	    callback(null, ret);
	  });
      };
    };
  });

  return {
    templateFormats: [
      'njk'
    ]
  };

Then you can use the new tag in your layout files:

<!-- liquid syntax -->
{% generator %}
<!-- nunjucks syntax -->
{% generator '' %}

License

MIT. See LICENSE

Package Sidebar

Install

npm i eleventy-plugin-meta-generator

Weekly Downloads

8

Version

0.3.1

License

MIT

Unpacked Size

5.86 kB

Total Files

8

Last publish

Collaborators

  • ryuno-ki