Skip to content

Commit

Permalink
chore: add sitemap for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Apr 14, 2024
1 parent 347cc2e commit 2470d72
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ __pypackages__/

public/en
public/zh
public/sitemap.xml
demo.py
13 changes: 12 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"sphinx.ext.extlinks",
"sphinx_copybutton",
"sphinx_design",
"sphinx_sitemap",
]

extlinks = {
Expand Down Expand Up @@ -83,11 +84,21 @@
"source_docs_path": "/docs/",
}

# sitemap configuration
site_url = "https://jose.authlib.org/"
sitemap_url_scheme = "{lang}{link}"
sitemap_filename = "../sitemap.xml"
sitemap_locales = []


def setup(app):
global language, html_baseurl
global language, html_baseurl, sitemap_filename, sitemap_locales

language = app.config.language
if language != 'en':
sitemap_filename = 'sitemap.xml'
sitemap_locales = [None]

html_baseurl = f"https://jose.authlib.org/{language}/"
html_context["languages"] = [
("English", f"https://jose.authlib.org/en/%s/", "en"),
Expand Down
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *

Sitemap: https://jose.authlib.org/sitemap.xml
1 change: 1 addition & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Sphinx
sphinx-design
sphinx-copybutton
sphinx-sitemap
shibuya

0 comments on commit 2470d72

Please sign in to comment.