-
Notifications
You must be signed in to change notification settings - Fork 0
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
GitAuto: Make our sitemap dynamically updated using a library #172
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
package.json
Outdated
@@ -4,7 +4,7 @@ | |||
"private": true, | |||
"scripts": { | |||
"dev": "next dev", | |||
"build": "next build", | |||
"build": "next build && next-sitemap", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use postbuild instead of build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
package.json
Outdated
@@ -46,6 +46,7 @@ | |||
"stripe": "^17.4.0", | |||
"swr": "^2.2.5", | |||
"uuid": "^11.0.3", | |||
"next-sitemap": "^4.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
insert it under next-auth as package.json is alphabetical order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add next-sitemap.config.js because it is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
next-sitemap.config.js
Outdated
@@ -0,0 +1,5 @@ | |||
module.exports = { | |||
siteUrl: 'https://www.yourwebsite.com', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use NEXT_PUBLIC_SITE_URL
from @/config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No you forgot to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use NEXT_PUBLIC_SITE_URL from @/config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
next-sitemap.config.js
Outdated
@@ -0,0 +1,5 @@ | |||
module.exports = { | |||
siteUrl: 'https://www.yourwebsite.com', | |||
generateRobotsTxt: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this url https://www.npmjs.com/package/next-sitemap for future ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
next-sitemap.config.js
Outdated
@@ -0,0 +1,5 @@ | |||
module.exports = { | |||
siteUrl: 'https://www.yourwebsite.com', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No you forgot to do this
next-sitemap.config.js
Outdated
@@ -0,0 +1,5 @@ | |||
module.exports = { | |||
siteUrl: 'https://www.yourwebsite.com', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use NEXT_PUBLIC_SITE_URL from @/config
next-sitemap.config.js
Outdated
// https://www.npmjs.com/package/next-sitemap | ||
const { NEXT_PUBLIC_SITE_URL } = require('@/config'); | ||
module.exports = { | ||
siteUrl: NEXT_PUBLIC_SITE_URL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, use NEXT_PUBLIC_SITE_URL from env simply not from @/config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
next-sitemap.config.js
Outdated
@@ -0,0 +1,7 @@ | |||
// https://www.npmjs.com/package/next-sitemap | |||
const NEXT_PUBLIC_SITE_URL = process.env.NEXT_PUBLIC_SITE_URL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved your feedback! Looks good?
next-sitemap.config.js
Outdated
@@ -0,0 +1,5 @@ | |||
module.exports = { | |||
siteUrl: 'https://www.yourwebsite.com', | |||
generateRobotsTxt: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it false
Resolves #167
What is the feature
Implement a dynamically updated sitemap by integrating a sitemap generation library. This ensures that the sitemap reflects the latest content automatically, improving SEO and user navigation without manual updates.
Where / How to code and why
Library Selection:
next-sitemap
library, which is specifically designed for Next.js applications and supports dynamic sitemap generation.Installation:
next-sitemap
to the project dependencies by running:Configuration:
next-sitemap.js
file in the root directory with the necessary configuration:Update Build Process:
package.json
scripts to include sitemap generation during the build process:Remove Static Sitemap:
app/sitemap.xml
to avoid conflicts with the dynamically generated sitemap.Testing:
Deployment:
Why:
Using
next-sitemap
leverages Next.js capabilities for automatic sitemap generation, ensuring scalability and reducing maintenance overhead. Removing the static sitemap eliminates the risk of outdated content being indexed.Anything the issuer needs to do
No action required.
Test these changes locally