Skip to content

Commit 85e509e

Browse files
committed
docs: fix html redirects not working
HTML redirects for docs broke during migration to esp-docs.
1 parent d0dd9ce commit 85e509e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/conf_common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,11 @@
171171
google_analytics_id = os.environ.get('CI_GOOGLE_ANALYTICS_ID', None)
172172

173173
project_homepage = 'https://github.com/espressif/esp-idf'
174+
175+
# Custom added feature to allow redirecting old URLs
176+
with open('../page_redirects.txt') as f:
177+
lines = [re.sub(' +', ' ', line.strip()) for line in f.readlines() if line.strip() != '' and not line.startswith('#')]
178+
for line in lines: # check for well-formed entries
179+
if len(line.split(' ')) != 2:
180+
raise RuntimeError('Invalid line in page_redirects.txt: %s' % line)
181+
html_redirect_pages = [tuple(line.split(' ')) for line in lines]

0 commit comments

Comments
 (0)