-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0eb95a8
commit 54c6e17
Showing
3 changed files
with
36 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Used to add the domain to sitemap.xml, replace it with a real domain in production | ||
WEBSITE_URL=http://localhost:3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,45 @@ | ||
### Sitemap for Static Next.Js App | ||
# With Sitemap example | ||
|
||
This is a static [Next.js](https://nextjs.org/) project which generates a sitemap for all the static paths. | ||
Everytime, you try to start a development server or make a build, you get an updated `sitemap.xml` file in `public` directory. | ||
This example shows how to generate Sitemap for static [Next.js](https://nextjs.org/) paths. | ||
Everytime, you try to start a development server or make a build, you get an updated `sitemap.xml` file in `public` directory(`http://localhost:3000/sitemap.xml`). | ||
|
||
## Getting Started | ||
**Note**: Everytime you add or remove a page from `pages` directory, you need to restart the server, to update your `pages/sitemap.xml` file. | ||
|
||
## Deploy your own | ||
|
||
Deploy the example using [Vercel](https://vercel.com): | ||
|
||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/hello-world) | ||
|
||
## How to use | ||
|
||
First, run the development server: | ||
### Using `create-next-app` | ||
|
||
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example: | ||
|
||
```bash | ||
npm run dev | ||
npx create-next-app --example with-sitemap with-sitemap-app | ||
# or | ||
yarn dev | ||
yarn create next-app --example with-sitemap with-sitemap-app | ||
``` | ||
|
||
Open [http://localhost:3000/sitemap.xml](http://localhost:3000/sitemap.xml) with your browser to see the sitemap. | ||
### Download manually | ||
|
||
**Note**: Everytime you add or remove a page from `pages` directory, you need to restart the server, to update your `pages/sitemap.xml` file. | ||
Download the example: | ||
|
||
## Deploy on Vercel | ||
```bash | ||
curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-sitemap | ||
cd with-sitemap | ||
``` | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
Install it and run: | ||
|
||
```bash | ||
npm install | ||
npm run dev | ||
# or | ||
yarn | ||
yarn dev | ||
``` | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. | ||
Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
<loc>http://localhost:3000</loc> | ||
<changefreq>hourly</changefreq> | ||
</url> | ||
</urlset> | ||
</urlset> |