Skip to content

Commit ecf042e

Browse files
committed
fix: stay on page
1 parent ef06886 commit ecf042e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hooks/stay_on_page.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ def on_post_page(output, page, config):
66
<ul class="md-select__list">
77
88
<li class="md-select__item">
9-
<a href="/leetcode/en/" hreflang="en" class="md-select__link">
9+
<a href="/en/" hreflang="en" class="md-select__link">
1010
English
1111
</a>
1212
</li>
1313
1414
<li class="md-select__item">
15-
<a href="/leetcode/" hreflang="zh" class="md-select__link">
15+
<a href="/" hreflang="zh" class="md-select__link">
1616
中文
1717
</a>
1818
</li>
@@ -21,10 +21,10 @@ def on_post_page(output, page, config):
2121
"""
2222

2323
url = page.abs_url
24-
cn_url = url.replace("/leetcode/en/", "/leetcode/")
25-
en_url = cn_url.replace("/leetcode/", "/leetcode/en/")
26-
support_en_lang = not cn_url.startswith("/leetcode/lcof") and not cn_url.startswith(
27-
"/leetcode/lcof2"
24+
cn_url = url.replace("/en/", "/")
25+
en_url = cn_url + "en/"
26+
support_en_lang = not cn_url.startswith("/lcof") and not cn_url.startswith(
27+
"/lcof2"
2828
)
2929
patterns = {
3030
"zh": r'(<a\s+[^>]*href=["\'])[^"\']*(["\'][^>]*hreflang=["\']zh["\'][^>]*>)',

0 commit comments

Comments
 (0)