Skip to content

Commit 75d9df0

Browse files
committed
Merge branch 'bugfix/html_redirect' into 'master'
docs: fix html redirects not working See merge request espressif/esp-idf!15928
2 parents ae9f423 + 85e509e commit 75d9df0

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
@@ -165,3 +165,11 @@
165165
google_analytics_id = os.environ.get('CI_GOOGLE_ANALYTICS_ID', None)
166166

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

0 commit comments

Comments
 (0)