Skip to content

Commit f1380d3

Browse files
authored
Add sitemap (#3035)
* Add sitemap * Remove PyTorch sphinx theme as submodule * Exclude src/pytorch_sphinx_theme/docs from the build so that the html pages under don't appear on the site and in the sitemap
1 parent 8a8331e commit f1380d3

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.ci/docker/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ sphinx-gallery==0.11.1
66
sphinx_design
77
docutils==0.16
88
sphinx-copybutton
9+
sphinx_sitemap==2.6.0
910
pypandoc==1.12
1011
pandocfilters
1112
markdown

.gitmodules

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

conf.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
'sphinx_copybutton',
8383
'sphinx_gallery.gen_gallery',
8484
'sphinx_design',
85+
'sphinx_sitemap'
8586
]
8687

8788
intersphinx_mapping = {
@@ -120,6 +121,14 @@ def reset_seeds(gallery_conf, fname):
120121
},
121122
}
122123

124+
html_baseurl = 'https://pytorch.org/tutorials/' # needed for sphinx-sitemap
125+
sitemap_locales = [None]
126+
sitemap_excludes = [
127+
"search.html",
128+
"genindex.html",
129+
]
130+
sitemap_url_scheme = "{link}"
131+
123132
if os.getenv('GALLERY_PATTERN'):
124133
# GALLERY_PATTERN is to be used when you want to work on a single
125134
# tutorial. Previously this was fed into filename_pattern, but
@@ -182,7 +191,7 @@ def reset_seeds(gallery_conf, fname):
182191
# List of patterns, relative to source directory, that match files and
183192
# directories to ignore when looking for source files.
184193
# This patterns also effect to html_static_path and html_extra_path
185-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
194+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'src/pytorch-sphinx-theme/docs*']
186195
exclude_patterns += sphinx_gallery_conf['examples_dirs']
187196
exclude_patterns += ['*/index.rst']
188197

0 commit comments

Comments
 (0)