From 9c58f0bd008004ce86b96841d10a59ed4e1805e1 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 12:46:44 -0700 Subject: [PATCH 01/18] Prepare hosting migration --- docs/_templates/layout.html | 15 +++++++++++++++ runtime.txt | 1 + 2 files changed, 16 insertions(+) create mode 100644 runtime.txt diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 93dd11ecd..3c83a4293 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -2,5 +2,20 @@ {%- block extrahead %} {{ super() }} + + + + + {# Alabaster theme native GA integration is outdated (ga.js). #} + {# Insert our own GA snippet instead. #} + {% endblock %} diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 000000000..d70c8f8d8 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +3.6 From 59c8a507f6c0c16f75478e22eafddabc3d5865f8 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 13:20:06 -0700 Subject: [PATCH 02/18] Fix non-https links --- docs/_templates/sidebarintro.html | 3 +-- docs/_templates/sidebarlogo.html | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html index ebe19b3df..85db655b3 100644 --- a/docs/_templates/sidebarintro.html +++ b/docs/_templates/sidebarintro.html @@ -13,8 +13,7 @@

Stay Informed

Receive updates on new releases and upcoming projects.

-

+

diff --git a/docs/_templates/sidebarlogo.html b/docs/_templates/sidebarlogo.html index abaa6305a..22bba28dd 100644 --- a/docs/_templates/sidebarlogo.html +++ b/docs/_templates/sidebarlogo.html @@ -13,8 +13,7 @@

Get Updates

Receive updates on new releases and upcoming projects.

-

+

Say Thanks!

From b3929171a5a1d0b2666c3cce9fc066de4db63b98 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 13:28:17 -0700 Subject: [PATCH 03/18] Don't load empty custom.css --- docs/_templates/layout.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 3c83a4293..63038740b 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -1,7 +1,9 @@ {% extends "!layout.html" %} {%- block extrahead %} - {{ super() }} + {# No super() because we want to avoid loading an empty custom.css file #} + + From 54921b17b2acd441fc7954419d283f7fdb801cd2 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 13:30:08 -0700 Subject: [PATCH 04/18] Favicon --- docs/_templates/layout.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 63038740b..b4031796b 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -6,6 +6,7 @@ + From e1a965067b766e4d770693787f83fbf70b7fa1ae Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 13:39:18 -0700 Subject: [PATCH 05/18] Fix canonical --- docs/_templates/layout.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index b4031796b..366dbf353 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -5,7 +5,12 @@ + {% if pagename == 'index' %} + + {% else %} + {% endif %} + From 728b9f10a204a6d0b63638253e6f6f94e14e7e08 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 13:49:52 -0700 Subject: [PATCH 06/18] Fix custom 404 --- docs/Makefile | 4 ++++ docs/_extra/_redirects | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 docs/_extra/_redirects diff --git a/docs/Makefile b/docs/Makefile index 40b479e94..6eff0bc39 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -59,6 +59,10 @@ dirhtml: @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." +netlify: dirhtml + @cp $(BUILDDIR)/dirhtml/404/index.html $(BUILDDIR)/dirhtml/404.html + @cp _extra/* $(BUILDDIR)/dirhtml/ + singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo diff --git a/docs/_extra/_redirects b/docs/_extra/_redirects new file mode 100644 index 000000000..5b0e2fe04 --- /dev/null +++ b/docs/_extra/_redirects @@ -0,0 +1,5 @@ +# https://www.netlify.com/docs/redirects/ + + +# Redirect internal URL to python-guide.org +# https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 301! From e3bedf76d47ecac53f1b13ba50f74a0f6b0c817d Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 13:51:10 -0700 Subject: [PATCH 07/18] Fix 404 canonical --- docs/_templates/layout.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 366dbf353..9660c14a5 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -7,6 +7,8 @@ {% if pagename == 'index' %} + {% elif pagename == '404' %} + {# No canonical on our 404 template. #} {% else %} {% endif %} From b6266ba4e55570e684fe6dd97af13164b2653ab8 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 13:57:32 -0700 Subject: [PATCH 08/18] Fix 404 relative paths --- docs/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Makefile b/docs/Makefile index 6eff0bc39..3b85476dd 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -61,6 +61,8 @@ dirhtml: netlify: dirhtml @cp $(BUILDDIR)/dirhtml/404/index.html $(BUILDDIR)/dirhtml/404.html + @sed -i -e 's/src="https://github.com///src="\//g' $(BUILDDIR)/dirhtml/404.html + @sed -i -e 's/href="https://github.com///href="\//g' $(BUILDDIR)/dirhtml/404.html @cp _extra/* $(BUILDDIR)/dirhtml/ singlehtml: From e6b57530dd41a6bf38ae0dfe850096ca69b40f65 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 14:00:22 -0700 Subject: [PATCH 09/18] Add redirects --- docs/_extra/_redirects | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/_extra/_redirects b/docs/_extra/_redirects index 5b0e2fe04..a113f1bec 100644 --- a/docs/_extra/_redirects +++ b/docs/_extra/_redirects @@ -1,5 +1,7 @@ # https://www.netlify.com/docs/redirects/ +# Redirect RTD /en/latest/ prefix +/en/latest/* /:splat 301! -# Redirect internal URL to python-guide.org +# TODO: Redirect internal URL to python-guide.org # https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 301! From e52e1a372197d6047fcc3e2cafaac1985aed1456 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 14:06:48 -0700 Subject: [PATCH 10/18] Update redirects --- docs/_extra/_redirects | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/_extra/_redirects b/docs/_extra/_redirects index a113f1bec..e88dab83d 100644 --- a/docs/_extra/_redirects +++ b/docs/_extra/_redirects @@ -1,7 +1,12 @@ -# https://www.netlify.com/docs/redirects/ +# Redirect rules +# Docs: https://www.netlify.com/docs/redirects/ -# Redirect RTD /en/latest/ prefix -/en/latest/* /:splat 301! +# Redirect http to https (avoid one extra hop with an explicit rule for /en/latest/) +http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 301! +http://docs.python-guide.org/* https://docs.python-guide.org/:splat 301! -# TODO: Redirect internal URL to python-guide.org -# https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 301! +# Redirect RTD prefix to / +/en/latest/* /:splat 301! + +# TODO: Redirect Netlify URL to python-guide.org +# https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 301! From 1e9a7ff8d10b7fa1de45c28471c501e1429196b4 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 14:09:14 -0700 Subject: [PATCH 11/18] Use 302 redirects for testing --- docs/_extra/_redirects | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/_extra/_redirects b/docs/_extra/_redirects index e88dab83d..4f12632d4 100644 --- a/docs/_extra/_redirects +++ b/docs/_extra/_redirects @@ -2,11 +2,12 @@ # Docs: https://www.netlify.com/docs/redirects/ # Redirect http to https (avoid one extra hop with an explicit rule for /en/latest/) -http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 301! -http://docs.python-guide.org/* https://docs.python-guide.org/:splat 301! +http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 302! +http://docs.python-guide.org/* https://docs.python-guide.org/:splat 302! # Redirect RTD prefix to / -/en/latest/* /:splat 301! +/en/latest/* /:splat 302! +# TODO: Make those cacheable 301s when we're done # TODO: Redirect Netlify URL to python-guide.org -# https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 301! +# https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 302! From 35a4e33868505727ba1dcfd9051def698bbd90ae Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 14:11:03 -0700 Subject: [PATCH 12/18] Test redirect behavior --- docs/_extra/_redirects | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_extra/_redirects b/docs/_extra/_redirects index 4f12632d4..350c2b964 100644 --- a/docs/_extra/_redirects +++ b/docs/_extra/_redirects @@ -2,8 +2,8 @@ # Docs: https://www.netlify.com/docs/redirects/ # Redirect http to https (avoid one extra hop with an explicit rule for /en/latest/) -http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 302! -http://docs.python-guide.org/* https://docs.python-guide.org/:splat 302! +# http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 302! +# http://docs.python-guide.org/* https://docs.python-guide.org/:splat 302! # Redirect RTD prefix to / /en/latest/* /:splat 302! From 936c3c7df55578f5d98a58088c210b206add6993 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 14:15:38 -0700 Subject: [PATCH 13/18] Redirect domain aliases --- docs/_extra/_redirects | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/_extra/_redirects b/docs/_extra/_redirects index 350c2b964..f70212b9a 100644 --- a/docs/_extra/_redirects +++ b/docs/_extra/_redirects @@ -2,8 +2,8 @@ # Docs: https://www.netlify.com/docs/redirects/ # Redirect http to https (avoid one extra hop with an explicit rule for /en/latest/) -# http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 302! -# http://docs.python-guide.org/* https://docs.python-guide.org/:splat 302! +http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 302! +http://docs.python-guide.org/* https://docs.python-guide.org/:splat 302! # Redirect RTD prefix to / /en/latest/* /:splat 302! @@ -11,3 +11,7 @@ # TODO: Make those cacheable 301s when we're done # TODO: Redirect Netlify URL to python-guide.org # https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 302! + +# Redirect domain aliases to primary domain +http://python-guide.org/* http://docs.python-guide.org/:splat 302! +https://python-guide.org/* https://docs.python-guide.org/:splat 302! From 40571f40e8286f5339ff43f56f64fd6493d6c021 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 14:35:36 -0700 Subject: [PATCH 14/18] Make HTTPS the default & update canonical --- CONTRIBUTING.md | 4 ++-- Readme.rst | 2 +- docs/404.rst | 4 ++-- docs/_templates/layout.html | 4 ++-- docs/_templates/sidebarintro.html | 4 ++-- docs/_templates/sidebarlogo.html | 2 +- docs/dev/virtualenvs.rst | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab145a5c3..5d325e061 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ How to contribute This guide is under heavy development. If you would like to contribute, please see: -http://docs.python-guide.org/en/latest/notes/contribute/ +https://docs.python-guide.org/en/latest/notes/contribute/ How to test your changes ------------------------ @@ -34,4 +34,4 @@ Style Guide For all contributions, please follow the `Guide Style Guide`: -http://docs.python-guide.org/en/latest/notes/styleguide/ +https://docs.python-guide.org/en/latest/notes/styleguide/ diff --git a/Readme.rst b/Readme.rst index 8dce3c079..d7d26dfb1 100644 --- a/Readme.rst +++ b/Readme.rst @@ -33,4 +33,4 @@ Topics include: If you aren't fond of reading reStructuredText, there is an almost up-to-date `HTML version at docs.python-guide.org -`_. +`_. diff --git a/docs/404.rst b/docs/404.rst index 4398775bc..1b4328506 100644 --- a/docs/404.rst +++ b/docs/404.rst @@ -8,9 +8,9 @@ It looks like this was the result of either: - a mistyped address - an out-of-date link -`Click here to go back to the homepage. `_ +`Click here to go back to the homepage. `_ -Or, try `searching `_. +Or, try `searching `_. .. raw:: html diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 9660c14a5..cc36fabbe 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -6,11 +6,11 @@ {% if pagename == 'index' %} - + {% elif pagename == '404' %} {# No canonical on our 404 template. #} {% else %} - + {% endif %} diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html index 85db655b3..8da869751 100644 --- a/docs/_templates/sidebarintro.html +++ b/docs/_templates/sidebarintro.html @@ -50,7 +50,7 @@

Contributors

This guide is the result of the collaboration of hundreds of people around the world, and your contributions - are welcome! + are welcome!

@@ -64,7 +64,7 @@

Useful Links

Translations

    -
  • English
  • +
  • English
  • French
  • Chinese
  • Japanese
  • diff --git a/docs/_templates/sidebarlogo.html b/docs/_templates/sidebarlogo.html index 22bba28dd..e418c53f4 100644 --- a/docs/_templates/sidebarlogo.html +++ b/docs/_templates/sidebarlogo.html @@ -48,7 +48,7 @@

    Other Projects

    Translations

      -
    • English
    • +
    • English
    • French
    • Chinese
    • Japanese
    • diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst index dadc299e9..5420bc69d 100644 --- a/docs/dev/virtualenvs.rst +++ b/docs/dev/virtualenvs.rst @@ -62,7 +62,7 @@ using your OS package manager, you may have to `install pip Date: Mon, 16 Jul 2018 14:45:07 -0700 Subject: [PATCH 15/18] Update redirects --- docs/_extra/_redirects | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/_extra/_redirects b/docs/_extra/_redirects index f70212b9a..29712f048 100644 --- a/docs/_extra/_redirects +++ b/docs/_extra/_redirects @@ -2,16 +2,15 @@ # Docs: https://www.netlify.com/docs/redirects/ # Redirect http to https (avoid one extra hop with an explicit rule for /en/latest/) -http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 302! -http://docs.python-guide.org/* https://docs.python-guide.org/:splat 302! +http://docs.python-guide.org/en/latest/* https://docs.python-guide.org/:splat 301! +http://docs.python-guide.org/* https://docs.python-guide.org/:splat 301! # Redirect RTD prefix to / -/en/latest/* /:splat 302! - -# TODO: Make those cacheable 301s when we're done -# TODO: Redirect Netlify URL to python-guide.org -# https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 302! +/en/latest/* /:splat 301! # Redirect domain aliases to primary domain -http://python-guide.org/* http://docs.python-guide.org/:splat 302! -https://python-guide.org/* https://docs.python-guide.org/:splat 302! +http://python-guide.org/* http://docs.python-guide.org/:splat 301! +https://python-guide.org/* https://docs.python-guide.org/:splat 301! + +# Redirect Netlify version to primary domain +https://python-guide.netlify.com/* https://docs.python-guide.org/:splat 301! From fc0e41f844225febf4e265bd03e8e37df1169d08 Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 15:14:28 -0700 Subject: [PATCH 16/18] Fix mobile layout --- docs/_templates/layout.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index cc36fabbe..2e7538979 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -3,7 +3,15 @@ {%- block extrahead %} {# No super() because we want to avoid loading an empty custom.css file #} - + {# #} + + + {% if pagename == 'index' %} From 64c752a2417e917887dce1070b146ee4d5fd04ec Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Mon, 16 Jul 2018 16:52:15 -0700 Subject: [PATCH 17/18] Update /en/latest/ internal links --- CONTRIBUTING.md | 4 ++-- docs/404.rst | 2 +- docs/_templates/sidebarintro.html | 4 ++-- docs/_templates/sidebarlogo.html | 2 +- docs/dev/virtualenvs.rst | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d325e061..5d9f03aa1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ How to contribute This guide is under heavy development. If you would like to contribute, please see: -https://docs.python-guide.org/en/latest/notes/contribute/ +https://docs.python-guide.org/notes/contribute/ How to test your changes ------------------------ @@ -34,4 +34,4 @@ Style Guide For all contributions, please follow the `Guide Style Guide`: -https://docs.python-guide.org/en/latest/notes/styleguide/ +https://docs.python-guide.org/notes/styleguide/ diff --git a/docs/404.rst b/docs/404.rst index 1b4328506..1cb26757c 100644 --- a/docs/404.rst +++ b/docs/404.rst @@ -10,7 +10,7 @@ It looks like this was the result of either: `Click here to go back to the homepage. `_ -Or, try `searching `_. +Or, try `searching `_. .. raw:: html diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html index 8da869751..1ac139d4c 100644 --- a/docs/_templates/sidebarintro.html +++ b/docs/_templates/sidebarintro.html @@ -50,7 +50,7 @@

      Contributors

      This guide is the result of the collaboration of hundreds of people around the world, and your contributions - are welcome! + are welcome!

      @@ -64,7 +64,7 @@

      Useful Links

      Translations

        -
      • English
      • +
      • English
      • French
      • Chinese
      • Japanese
      • diff --git a/docs/_templates/sidebarlogo.html b/docs/_templates/sidebarlogo.html index e418c53f4..34c0ad966 100644 --- a/docs/_templates/sidebarlogo.html +++ b/docs/_templates/sidebarlogo.html @@ -48,7 +48,7 @@

        Other Projects

        Translations

          -
        • English
        • +
        • English
        • French
        • Chinese
        • Japanese
        • diff --git a/docs/dev/virtualenvs.rst b/docs/dev/virtualenvs.rst index 5420bc69d..06f20dde4 100644 --- a/docs/dev/virtualenvs.rst +++ b/docs/dev/virtualenvs.rst @@ -62,7 +62,7 @@ using your OS package manager, you may have to `install pip Date: Mon, 16 Jul 2018 17:06:02 -0700 Subject: [PATCH 18/18] Fix http sidebar link --- docs/_templates/sidebarintro.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html index 1ac139d4c..74e3afabf 100644 --- a/docs/_templates/sidebarintro.html +++ b/docs/_templates/sidebarintro.html @@ -56,9 +56,9 @@

          Contributors

          Useful Links