Repository: eslint/eslint
File: docs/.eleventy.js (JavaScript)

Code before:
     * docs to be loaded from /docs/latest or /docs/next on eslint.org.
     *
     * The path prefix is turned off for deploy previews so we can properly
     * see changes before deployed.
     */

    let pathPrefix = "/docs/head/";

    if (process.env.CONTEXT === "deploy-preview") {
        pathPrefix = "/";
    } else if (process.env.BRANCH === "latest") {
        pathPrefix = "/docs/latest/";
    } else if (process.env.BRANCH === "next") {
        pathPrefix = "/docs/next/";
    }

    //------------------------------------------------------------------------------
    // Data
    //------------------------------------------------------------------------------

    // Load site-specific data
    const siteName = process.env.ESLINT_SITE_NAME || "en";

    eleventyConfig.addGlobalData("site_name", siteName);
    eleventyConfig.addGlobalData("GIT_BRANCH", process.env.BRANCH);
    eleventyConfig.addGlobalData("HEAD", process.env.BRANCH === "main";
    eleventyConfig.addGlobalData("NOINDEX", process.env.BRANCH !== "latest");
    eleventyConfig.addDataExtension("yml", contents => yaml.load(contents));

    //------------------------------------------------------------------------------
    // Filters
    //------------------------------------------------------------------------------

    eleventyConfig.addFilter("limitTo", (arr, limit) => arr.slice(0, limit));

    eleventyConfig.addFilter("jsonify", variable => JSON.stringify(variable));

    /**
     * Takes in a string and converts to a slug
     * @param {string} text text to be converted into slug
     * @returns {string} slug to be used as anchors
     */
    function slugify(text) {
        return slug(text.replace(/[<>()[\]{}]/gu, ""))
        // eslint-disable-next-line no-control-regex -- used regex from https://github.com/eslint/archive-website/blob/master/_11ty/plugins/markdown-plugins.js#L37
            .replace(/[^\u{00}-\u{FF}]/gu, "");
    }

    eleventyConfig.addFilter("slugify", str => {
        if (!str) {
            return "";

Review comment (suggestion):
```suggestion
    eleventyConfig.addGlobalData("HEAD", process.env.BRANCH === "main");
```

Code after:
     * docs to be loaded from /docs/latest or /docs/next on eslint.org.
     *
     * The path prefix is turned off for deploy previews so we can properly
     * see changes before deployed.
     */

    let pathPrefix = "/docs/head/";

    if (process.env.CONTEXT === "deploy-preview") {
        pathPrefix = "/";
    } else if (process.env.BRANCH === "latest") {
        pathPrefix = "/docs/latest/";
    } else if (process.env.BRANCH === "next") {
        pathPrefix = "/docs/next/";
    }

    //------------------------------------------------------------------------------
    // Data
    //------------------------------------------------------------------------------

    // Load site-specific data
    const siteName = process.env.ESLINT_SITE_NAME || "en";

    eleventyConfig.addGlobalData("site_name", siteName);
    eleventyConfig.addGlobalData("GIT_BRANCH", process.env.BRANCH);
    eleventyConfig.addGlobalData("HEAD", process.env.BRANCH === "main");
    eleventyConfig.addGlobalData("NOINDEX", process.env.BRANCH !== "latest");
    eleventyConfig.addDataExtension("yml", contents => yaml.load(contents));

    //------------------------------------------------------------------------------
    // Filters
    //------------------------------------------------------------------------------

    eleventyConfig.addFilter("limitTo", (arr, limit) => arr.slice(0, limit));

    eleventyConfig.addFilter("jsonify", variable => JSON.stringify(variable));

    /**
     * Takes in a string and converts to a slug
     * @param {string} text text to be converted into slug
     * @returns {string} slug to be used as anchors
     */
    function slugify(text) {
        return slug(text.replace(/[<>()[\]{}]/gu, ""))
        // eslint-disable-next-line no-control-regex -- used regex from https://github.com/eslint/archive-website/blob/master/_11ty/plugins/markdown-plugins.js#L37
            .replace(/[^\u{00}-\u{FF}]/gu, "");
    }

    eleventyConfig.addFilter("slugify", str => {
        if (!str) {
            return "";