From ca7c95e5c39443a63a8bd55a6de3f56a12786dfd Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 21 Aug 2020 13:11:18 +0200 Subject: [PATCH] DOC: add redirects for old pages (#1577) --- doc/source/_templates/redirect.html | 10 ++++++++++ doc/source/conf.py | 31 +++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 doc/source/_templates/redirect.html diff --git a/doc/source/_templates/redirect.html b/doc/source/_templates/redirect.html new file mode 100644 index 0000000..9bb345f --- /dev/null +++ b/doc/source/_templates/redirect.html @@ -0,0 +1,10 @@ +{% set redirect = redirects[pagename.split("/")[-1]] %} + + + + This page has moved + + +

This page has moved here.

+ + diff --git a/doc/source/conf.py b/doc/source/conf.py index 717a0cf..6261c8e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -193,6 +193,33 @@ html_static_path = ["_static"] # template names. # html_additional_pages = {} +# Add redirect for previously existing pages, each item is like `(from_old, to_new)` + +moved_pages = [ + # user guide + ("aggregation_with_dissolve", "docs/user_guide/aggregation_with_dissolve"), + ("data_structures", "docs/user_guide/data_structures"), + ("geocoding", "docs/user_guide/geocoding"), + ("geometric_manipulations", "docs/user_guide/geometric_manipulations"), + ("indexing", "docs/user_guide/indexing"), + ("io", "docs/user_guide/io"), + ("mapping", "docs/user_guide/mapping"), + ("mergingdata", "docs/user_guide/mergingdata"), + ("missing_empty", "docs/user_guide/missing_empty"), + ("projections", "docs/user_guide/projections"), + ("set_operations", "docs/user_guide/set_operations"), + # other + ("install", "getting_started/install"), + ("reference", "docs/reference"), + ("changelog", "docs/changelog"), + ("code_of_conduct", "community/code_of_conduct"), + ("contributing", "community/contributing"), +] + +html_additional_pages = {page[0]: "redirect.html" for page in moved_pages} + +html_context = {"redirects": {old: new for old, new in moved_pages}} + # If false, no module index is generated. # html_domain_indices = True @@ -237,7 +264,7 @@ latex_elements = { # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ("index", "GeoPandas.tex", u"GeoPandas Documentation", u"Kelsey Jordahl", "manual"), + ("index", "GeoPandas.tex", u"GeoPandas Documentation", u"Kelsey Jordahl", "manual") ] # The name of an image file (relative to this directory) to place at the top of @@ -285,7 +312,7 @@ texinfo_documents = [ "GeoPandas", "One line description of project.", "Miscellaneous", - ), + ) ] # Documents to append as an appendix to all manuals.