Skip to content

Commit 6d0a08d

Browse files
authored
feat(docs): add stable links for external sites (#9620)
* add stable links for external docs this is usefull for the CII best practices badge and other sites where we might need stable links; assuming we maintain control of docs.inventree.org seems like a stable bet with current structures * fix checking logic * fix link target
1 parent 3fe0875 commit 6d0a08d

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

docs/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def check_link(url) -> bool:
9393

9494
while attempts > 0:
9595
response = requests.head(url, timeout=5000)
96-
if response.status_code == 200:
96+
# Ensure GH is not causing issues
97+
if response.status_code in (200, 429):
9798
# Update the cache file
9899
with open(CACHE_FILE, 'a', encoding='utf-8') as f:
99100
f.write(f'{url}\n')

docs/mkdocs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,22 @@ plugins:
261261
show_symbol_type_toc: true
262262
show_root_heading: false
263263
show_root_toc_entry: false
264+
- redirects:
265+
redirect_maps:
266+
'sref/contrib.md': 'develop/contributing.md' # https://github.com/inventree/InvenTree/blob/master/CONTRIBUTING.md.
267+
'sref/docs.md': 'index.md' # https://docs.inventree.org/en/latest/
268+
'sref/api.md': 'api/index.md' # https://demo.inventree.org/api-doc/
269+
'sref/code.md': 'https://github.com/inventree/InvenTree/tree/master' # https://github.com/inventree/InvenTree/tree/master
270+
'sref/oci-image.md': 'https://hub.docker.com/r/inventree/inventree/tags' # https://hub.docker.com/r/inventree/inventree/tags
271+
'sref/releases.md': 'https://github.com/inventree/InvenTree/releases' # https://github.com/inventree/InvenTree/releases
272+
'sref/issues.md': 'https://github.com/inventree/InvenTree/issues' # https://github.com/inventree/InvenTree/issues
273+
'sref/security-policy.md': 'https://github.com/inventree/InvenTree/security/policy' # https://github.com/inventree/InvenTree/security/policy
274+
'sref/security-history.md': 'https://huntr.dev/repos/inventree/inventree/' # https://huntr.dev/repos/inventree/inventree/
275+
'sref/ci.md': 'https://github.com/inventree/InvenTree/actions' # https://github.com/inventree/InvenTree/actions
276+
'sref/ci-sample.md': 'https://github.com/inventree/InvenTree/blob/master/.github/workflows/qc_checks.yaml' # https://github.com/inventree/InvenTree/blob/master/.github/workflows/qc_checks.yaml
277+
'sref/ci-pre.md': 'https://github.com/inventree/InvenTree/blob/master/.pre-commit-config.yaml' # https://github.com/inventree/InvenTree/blob/master/.pre-commit-config.yaml
278+
'sref/test-sample.md': 'https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/InvenTree/tests.py' # https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/InvenTree/tests.py
279+
'sref/coverage.md': 'https://coveralls.io/github/inventree/InvenTree' # https://coveralls.io/github/inventree/InvenTree
264280

265281
# Extensions
266282
markdown_extensions:

docs/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ mkdocs==1.6.1
22
mkdocs-macros-plugin>=0.7,<2.0
33
mkdocs-material>=9.0,<10.0
44
mkdocs-git-revision-date-localized-plugin>=1.1,<2.0
5+
mkdocs-redirects
56
mkdocs-simple-hooks>=0.1,<1.0
67
mkdocs-include-markdown-plugin
78
neoteroi-mkdocs

docs/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ mkdocs==1.6.1 \
306306
# mkdocs-include-markdown-plugin
307307
# mkdocs-macros-plugin
308308
# mkdocs-material
309+
# mkdocs-redirects
309310
# mkdocs-simple-hooks
310311
# mkdocstrings
311312
# neoteroi-mkdocs
@@ -339,6 +340,10 @@ mkdocs-material-extensions==1.3.1 \
339340
--hash=sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443 \
340341
--hash=sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31
341342
# via mkdocs-material
343+
mkdocs-redirects==1.2.2 \
344+
--hash=sha256:3094981b42ffab29313c2c1b8ac3969861109f58b2dd58c45fc81cd44bfa0095 \
345+
--hash=sha256:7dbfa5647b79a3589da4401403d69494bd1f4ad03b9c15136720367e1f340ed5
346+
# via -r docs/requirements.in
342347
mkdocs-simple-hooks==0.1.5 \
343348
--hash=sha256:dddbdf151a18723c9302a133e5cf79538be8eb9d274e8e07d2ac3ac34890837c \
344349
--hash=sha256:efeabdbb98b0850a909adee285f3404535117159d5cb3a34f541d6eaa644d50a

0 commit comments

Comments
 (0)