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

Please explain how I can use this library #830

Open
willhama opened this issue Jun 24, 2024 · 7 comments
Open

Please explain how I can use this library #830

willhama opened this issue Jun 24, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@willhama
Copy link

Is your feature request related to a problem? Please describe.
The documentation is lacking quite a few open questions to me. How can I use this library? When do I run the postscript command? What's the best practice? Do I put it in my CICD pipeline? How can I test the command locally? What the expected output?

Describe the solution you'd like
I want a clear description of how this library can be executed and what is the expected outcome.

Describe alternatives you've considered
I have considered writing the sitemap by myself.

Additional context
Currently I am running pnpm run build and it creates basically an empty sitemap:

`
sitemap.xml

http://localhost:3000/sitemap-0.xml

sitemap-0.xml

http://localhost:3000/opengraph-image.jpg2024-06-24T12:47:00.408Zdaily0.7 http://localhost:3000/twitter-image.jpg2024-06-24T12:47:00.409Zdaily0.7 `

Thank you very much upfront for your support.

@willhama willhama added the enhancement New feature or request label Jun 24, 2024
@ollebergkvist
Copy link

ollebergkvist commented Jul 2, 2024

Same issue here, using latest version of nextjs (app router), we also just get an empty sitemap...

Have followed the instructions in the docs.

Copy link

github-actions bot commented Sep 1, 2024

Closing this issue due to inactivity.

@LZL0
Copy link

LZL0 commented Sep 1, 2024

Same issue.

@jamesryan-dev
Copy link

same issue

@BiBzz
Copy link

BiBzz commented Sep 23, 2024

Hi @themataleao,
For your questions :

  • How can I use this library?
    • Since you seem to use PNPM : pnpm install next-sitemap
    • Create config file. For example :
    module.exports = {
      siteUrl: "https://yourdomain.com",
      generateRobotsTxt: true,
    };
    • Add postbuild command in package.json
    "scripts": {
      "dev": "next dev -H 0.0.0.0",
      "build": "next build",
      "postbuild": "next-sitemap",
      "start": "next start",
      "lint": "next lint"
    },
    • Generate robots.txt and sitemap.xml with pnpm postbuild
  • When do I run the postscript command?
    When you want generate robots.txt and sitemap.xml. Locally or during CI/CD
  • What's the best practice?
    No idea at all. I 'm currently doing it locally and push them to make sure they're perfectly up to date
  • How can I test the command locally?
    You can use npx next-sitemap to focus locally.
  • What the expected output?
    At least 2 sitemaps and 1 optionally generated robots.txt (robots.txt generation isn't shown in console, but it's here)
✅ [next-sitemap] Generation completed
┌───────────────┬────────┐
│ (index)       │ Values │
├───────────────┼────────┤
│ indexSitemaps │ 1      │
│ sitemaps      │ 1      │
└───────────────┴────────┘
-----------------------------------------------------
 SITEMAP INDICES 
-----------------------------------------------------

   ○ https://yourdomain.com/sitemap.xml


-----------------------------------------------------
 SITEMAPS 
-----------------------------------------------------

   ○ https://yourdomain.com/sitemap-0.xml

I hope it'll help! Have a great day.

@topwood
Copy link

topwood commented Oct 21, 2024

same issue

@IsDyh01
Copy link

IsDyh01 commented Dec 17, 2024

hi @BiBzz ,I am using this library, and when I execute the npx next-sitemap command, it generates an empty sitemap file。

next: 14.2.3 next-sitemap: 4.2.3

┌───────────────┬────────┐
│ (index) │ Values │
├───────────────┼────────┤
│ indexSitemaps │ 1 │
│ sitemaps │ 0 │
└───────────────┴────────┘

next-sitemap.config.js
module.exports = {
siteUrl: 'localhost:3000',
generateRobotsTxt: true, // (optional)
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants