0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Add instructions on how to link the sitemap (#6448)

* Add instructions on how to link the sitemap

* Update packages/integrations/sitemap/README.md

Co-authored-by: Dan Jutan <danjutan@gmail.com>

---------

Co-authored-by: Dan Jutan <danjutan@gmail.com>
This commit is contained in:
Tc001 2023-03-07 20:45:36 +02:00 committed by GitHub
parent cf8454f796
commit 28e1224d12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,6 +82,22 @@ Now, [build your site for production](https://docs.astro.build/en/reference/cli-
> **Warning**
> If you forget to add a `site`, you'll get a friendly warning when you build, and the `sitemap-index.xml` file won't be generated.
After verifying that the sitemaps are built, you can add them to your site's `<head>` and the `robots.txt` file for crawlers to pick up.
```html ins={3}
// src/layouts/Layout.astro
<head>
<link rel="sitemap" href="/sitemap-index.xml">
</head>
```
```txt ins={4} title="public/robots.txt"
User-agent: *
Allow: /
Sitemap: https://<YOUR SITE>/sitemap-index.xml
```
### Example of generated files for a two-page website
**`sitemap-index.xml`**