8000 MAINT Adds sphinx configuration for redirections by thomasjpfan · Pull Request #20625 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

MAINT Adds sphinx configuration for redirections #20625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@

# Additional templates that should be rendered to pages, maps page names to
# template names.
html_additional_pages = {
"index": "index.html",
"documentation": "documentation.html",
} # redirects to index
html_additional_pages = {"index": "index.html"}

# If false, no module index is generated.
html_domain_indices = False
Expand Down Expand Up @@ -232,6 +229,19 @@
highlight_version = ".".join(latest_highlights.split("_")[-3:-1])
html_context["release_highlights_version"] = highlight_version


# redirects dictionary maps from old links to new links
redirects = {
"documentation": "index",
"auto_examples/feature_selection/plot_permutation_test_for_classification": (
"auto_examples/model_selection/plot_permutation_tests_for_classification"
),
}
html_context["redirects"] = redirects
for old_link in redirects:
html_additional_pages[old_link] = "redirects.html"


# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{% set redirect = pathto(redirects[pagename]) %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Refresh" content="0; url={{ pathto('index') }}" />
<meta http-equiv="Refresh" content="0; url={{ redirect }}" />
<meta name="Description" content="scikit-learn: machine learning in Python">
<link rel="canonical" href="{{ pathto('index') }}" />
<link rel="canonical" href="{{ redirect }}" />
<title>scikit-learn: machine learning in Python</title>
</head>
<body>
<p>You will be automatically redirected to the <a href="{{ pathto('index') }}">main page</a>.</p>
<p>You will be automatically redirected to the <a href="{{ redirect }}">new location of this page</a>.</p>
</body>
</html>

This file was deleted.

0