{"id":13423761,"url":"https://github.com/stovv/next-strapi-sitemap","last_synced_at":"2025-03-15T17:32:18.306Z","repository":{"id":123665309,"uuid":"331082939","full_name":"stovv/next-strapi-sitemap","owner":"stovv","description":"Generate sitemap and robots.txt for NextJS used web hook from STRAPI","archived":false,"fork":false,"pushed_at":"2021-01-19T20:07:39.000Z","size":84,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-26T23:12:32.154Z","etag":null,"topics":["nextjs","robots-txt","sitemap","strapi"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stovv.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-01-19T19:11:30.000Z","updated_at":"2022-05-28T22:38:12.000Z","dependencies_parsed_at":"2024-04-09T22:50:50.135Z","dependency_job_id":"bd290240-c221-4754-bb87-b394ed1c2828","html_url":"https://github.com/stovv/next-strapi-sitemap","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stovv%2Fnext-strapi-sitemap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stovv%2Fnext-strapi-sitemap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stovv%2Fnext-strapi-sitemap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stovv%2Fnext-strapi-sitemap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stovv","download_url":"https://codeload.github.com/stovv/next-strapi-sitemap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243767275,"owners_count":20344898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nextjs","robots-txt","sitemap","strapi"],"created_at":"2024-07-31T00:00:41.900Z","updated_at":"2025-03-15T17:32:17.412Z","avatar_url":"https://github.com/stovv.png","language":"JavaScript","funding_links":[],"categories":["Boilerplates"],"sub_categories":[],"readme":"# SiteMap and Robots.txt generator for NextJS with STR API\n\n## Getting started\n1. Clone into `scripts` folder into nextjs project \n    ```bash\n    cd \u003cyour project on nextjs\u003e\n    git clone https://github.com/stovv/next-strapi-sitemap.git scripts\n    ```\n2. Install dependencies\n    ```bash\n    cd  \u003cyour project on nextjs\u003e/scripts\n    \n    # if you use yarn\n    yarn install\n    \n    # if you use npm\n    # npm install \n    ```\n3. Update start command in package.json\n    ```json\n    {\n        \"name\": \"project name\",\n        ...\n        \"start\": \"next start \u0026 cd scripts;node sitemap-generator.js\"\n    }\n    ```\n4. Create `.env` file by example in `.env.example`\n    ```dotenv\n    # port for sitemap generator server \n    PORT=\n    \n    # host name of site for sitemap generate\n    # e.g https://sitename.com\n    HOST=\n   \n    # host name for your strapi instanse\n    # e.g https://strapi.sitename.com\n    BACKEND_HOST=\n    \n    # a secret token that will be transmitted to the generator to check the adequacy of the call\n    WEBHOOK_TOKEN=\n    ```\n6. Generate webhook token  \n    You can use services like this https://www.random.org/strings/\n7. Go to your strapi admin panel\n    1. Open admin/settings/webhooks\n    2. Click to `Create New Webhook` button\n    3. Fill\n        - Name\n        - URL = http://localhost:\u003cport from .env file\u003e\n    4. Add Header\n        - Key = Authorization\n        - Value = your generated webhook token from 6 step\n    5. Select all action on entry (create, update, delete)\n    \n    ![webhook example](img/webhook_configuration.png)\n8. Update `next.config.js` for initial generate sitemaps and robots on `next build`\n   ```javascript\n    // next.config.js\n    const withPlugins = require('next-compose-plugins');\n    module.exports = withPlugins(\n        [ ],\n        {\n            webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) =\u003e {\n                if (isServer){\n                // Generate sitemaps and robots.txt\n                    const { generate } = require('./scripts/generate-sitemap');\n                    generate(\n                    // Public host name for sitemap generation\n                    'https://sitename.ru',\n                    // subfolder for generated sitemaps (not index sitemap) in public folder\n                    'sitemaps',\n                    // folder for generated sitemaps and robots.txt\n                    './public',\n                    // disallow routes in robots.txt\n                    ['/api/', '/login']\n                    );\n                }\n                return config;\n            }\n        }\n    );\n   ```\n9. Start your project by `yarn start` or `npm run start`\n\n---\n### Enjoy! 🤘\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstovv%2Fnext-strapi-sitemap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstovv%2Fnext-strapi-sitemap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstovv%2Fnext-strapi-sitemap/lists"}