Socket
Socket
Sign inDemoInstall

eleventy-plugin-meta-generator

Package Overview
Dependencies
747
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eleventy-plugin-meta-generator

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


Version published
Weekly downloads
6
decreased by-33.33%
Maintainers
1
Install size
5.72 kB
Created
Weekly downloads
 

Readme

Source

eleventy-plugin-meta-generator

Known Vulnerabilities

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

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

Keywords

FAQs

Last updated on 16 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc