Skip to content

Commit b56033e

Browse files
authored
Add a custom sitemap for Read The Docs (#484)
* add custom sitemap * disable nikola sitemap plugin * add custom robots.txt * update readthedocs configuration * ignore custom sitemap spelling * add maintainers file with details on sitemap generation
1 parent 1cdcdf4 commit b56033e

File tree

6 files changed

+73087
-4
lines changed

6 files changed

+73087
-4
lines changed

.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[codespell]
2-
skip = *.svg,./cache,./output,./venv,./plugins,conf.py,clipboard.min.js
2+
skip = *.svg,./cache,./output,./venv,./plugins,conf.py,clipboard.min.js,ansible-sitemap.xml
33
count =
44
check-filenames = true
55
quiet-level = 3

.readthedocs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ build:
1515
- nikola build
1616
- mkdir -p _readthedocs/html/
1717
- cp -r output/* _readthedocs/html/
18-
- rm _readthedocs/html/robots.txt
18+
- cp robots.txt _readthedocs/html/
19+
- cp ansible-sitemap.xml _readthedocs/html/

MAINTAINERS.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Maintainers guide
2+
3+
Find information for maintaining the `ansible-community/ansible-docsite` repository as well as periodic updates for releases and other events.
4+
5+
## Updating the sitemap
6+
7+
A [sitemap](https://docs.readthedocs.com/platform/stable/reference/sitemaps.html) is a file that search engine crawlers use to index the documentation.
8+
This repository includes a custom `sitemap.xml` that needs to be updated when:
9+
10+
- A new "latest" version of the Ansible community package is released.
11+
- A new version of the Ansible community package documentation is added to Read The Docs.
12+
- A new project is added to the Ansible namespace in Read The Docs.
13+
- Substantial changes are made to the Ansible documentation that adds or removes multiple pages.
14+
15+
Read The Docs generates a sitemap named `sitemap.xml` that you cannot overwrite.
16+
However you can overwrite the `robots.txt` file that Read The Docs generates and point to the url of a custom sitemap.
17+
For this reason, the custom sitemap is named `ansible-sitemap.xml`.
18+
The custom sitemap is additive to the Read The Docs sitemap and provides the full structure of all projects in the Ansible namespace in Read The Docs.
19+
20+
To generate the sitemap, do the following:
21+
22+
1. Install nodejs, if required, and the sitemap generator.
23+
```bash
24+
sudo dnf install nodejs
25+
sudo npm install -g sitemap-generator-cli
26+
```
27+
1. Generate a sitemap named `ansible-sitemap.xml`.
28+
```bash
29+
sitemap-generator -f ansible-sitemap.xml https://docs.ansible.com/
30+
```
31+
1. Commit the updates to `ansible-sitemap.xml` and open a pull request.
32+
33+
> The custom sitemap must be added to the Google Search Console as a one-time only configuration.

0 commit comments

Comments
 (0)