fix(_redirects): better redirect HTML & fix redirects (#4689)

-   用户不需要启用 JavaScript
-   通过设置 canonical 和 noindex 进行 SEO

reference: 1477d0ba90/tpl/tplimpl/embedded/templates/alias.html
pull/4700/head
Yufan You 2023-02-13 00:47:08 +08:00 committed by GitHub
parent c179934094
commit 4c2b96edda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 9 deletions

View File

@ -1,6 +1,5 @@
DirectoryPath: site
CheckDoctype: false
CheckMailto: false
IgnoreAltMissing: true

View File

@ -5,10 +5,11 @@
/intro/common-mistakes /contest/common-mistakes
/intro/common-tricks /contest/common-tricks
/intro/non-trad /contest/problems
/intro/judgers /tools/judgers
/intro/judgers /tools/judger
/tools/judgers /tools/judger
/intro/wsl /tools/wsl
/intro/spj /tools/spj
/intro/testlib/index /tools/testlib/index
/intro/spj /tools/special-judge
/intro/testlib /tools/testlib
/intro/testlib/general /tools/testlib/general
/intro/testlib/generator /tools/testlib/generator
/intro/testlib/validator /tools/testlib/validator
@ -43,8 +44,8 @@
/math/basis /math/linear-algebra/basis
/math/char-poly /math/linear-algebra/char-poly
/math/gauss /math/linear-algebra/gauss
/math/linear-algebra-index /math/linear-algebra/index
/math/martix /math/linear-algebra/martix
/math/linear-algebra-index /math/linear-algebra
/math/martix /math/linear-algebra/matrix
/math/vector /math/linear-algebra/vector
/math/gen-func/intro /math/poly/intro
/math/gen-func/symbolic-method /math/poly/symbolic-method

View File

@ -9,6 +9,4 @@ for cur in f.readlines():
html_path = os.path.join('site', s.lstrip('/'), 'index.html')
os.makedirs(os.path.dirname(html_path), exist_ok=True)
with open(html_path, 'w') as html_file:
# print(f"<script type=\"text/javascript\">location.href=\"{t}\"</script>")
html_file.write(f"<script type=\"text/javascript\">location.href=\"{t}\"</script>\n")
# print(html_path)
html_file.write(f'<!DOCTYPE html><html><head><link rel="canonical" href="https://oi-wiki.org{t}"/><meta name="robots" content="noindex"><meta charset="utf-8" /><meta http-equiv="refresh" content="0; url={t}" /></head></html>')