Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
khattakdev committed Jul 23, 2020
1 parent 0eb95a8 commit 54c6e17
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
2 changes: 2 additions & 0 deletions examples/with-sitemap/.env
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
45 changes: 33 additions & 12 deletions examples/with-sitemap/README.md
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)).
2 changes: 1 addition & 1 deletion examples/with-sitemap/public/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
<loc>http://localhost:3000</loc>
<changefreq>hourly</changefreq>
</url>
</urlset>
</urlset>

0 comments on commit 54c6e17

Please sign in to comment.