sphinx-reredirects-0.1.2/ 0000775 0000000 0000000 00000000000 14431353004 0015331 5 ustar 00root root 0000000 0000000 sphinx-reredirects-0.1.2/.gitignore 0000664 0000000 0000000 00000000306 14431353004 0017320 0 ustar 00root root 0000000 0000000 # Python
venv/
__pycache__
dist
*.egg-info
build
.eggs
.tox
# IDEs
.idea/
!.idea/runConfigurations
.vscode/
# Where GitLab Pages expects website
public/
# Sphinx
.doctrees
_build
# Mac
.DS_Store sphinx-reredirects-0.1.2/.gitlab-ci.yml 0000664 0000000 0000000 00000000623 14431353004 0017766 0 ustar 00root root 0000000 0000000 image: python:3.9
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv
- .tox
before_script:
- python3 --version
- python3 -m pip install tox
test:
stage: test
script:
- tox
docs:
stage: test
script:
- tox -e docs
pages:
only:
- master
stage: deploy
script:
- tox -e docs
artifacts:
paths:
- public
sphinx-reredirects-0.1.2/LICENSE 0000664 0000000 0000000 00000002744 14431353004 0016345 0 ustar 00root root 0000000 0000000 BSD 3-Clause License
Copyright (c) 2020, documatt
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sphinx-reredirects-0.1.2/README.rst 0000664 0000000 0000000 00000003317 14431353004 0017024 0 ustar 00root root 0000000 0000000 ##################
sphinx-reredirects
##################
.. image:: https://img.icons8.com/wired/64/undefined/forward-arrow--v1.png
:align: right
.. image:: https://gitlab.com/documatt/sphinx-reredirects/badges/master/pipeline.svg
:target: https://gitlab.com/documatt/sphinx-reredirects/-/commits/master
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. image:: https://img.shields.io/pypi/v/sphinx-reredirects
:target: https://pypi.org/project/sphinx-reredirects/
sphinx-reredirects is the extension for `Sphinx documentation `_ projects that handles redirects for moved pages. It generates HTML pages with meta refresh redirects to the new page location to prevent 404 errors if you rename or move your documents.
* docs: https://documatt.gitlab.io/sphinx-reredirects
* code: https://gitlab.com/documatt/sphinx-reredirects where issues and contributions are welcome
Good URLs are never changing URLs. But if you must, sphinx-reredirects helps you manage redirects with ease and from the single place in project's ``conf.py``. For example, if you rename document ``start`` to ``intro``, and tell it to sphinx-reredirects, it will generate HTML page ``start.html`` with ````. The extension supports wildcards and moving to different domain too.
*****
About
*****
sphinx-reredirects started from the urge to manage redirects for all documents during moving our *Tech writer at work blog* to the new domain https://documatt.com/blog/.
*****
Legal
*****
Forward Arrow icon by `Icons8 `_.
sphinx-reredirects is licensed under BSD3.
sphinx-reredirects-0.1.2/docs/ 0000775 0000000 0000000 00000000000 14431353004 0016261 5 ustar 00root root 0000000 0000000 sphinx-reredirects-0.1.2/docs/Makefile 0000664 0000000 0000000 00000001172 14431353004 0017722 0 ustar 00root root 0000000 0000000 # Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
sphinx-reredirects-0.1.2/docs/conf.py 0000664 0000000 0000000 00000004210 14431353004 0017555 0 ustar 00root root 0000000 0000000 # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
from datetime import date
# -- Project information -----------------------------------------------------
project = 'sphinx-reredirects'
copyright = f'{date.today().year}, Documatt'
author = 'Matt'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
rst_epilog = f'''
.. |project| replace:: {project}
'''
highlight_language = 'none'
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_logo = 'logo.png'
html_theme = 'sphinx_documatt_theme'
html_theme_options = {
'motto': f'{project} is the extension for Sphinx documentation projects that handles redirects for moved pages. It generates HTML pages with meta refresh redirects to the new page location to prevent 404 errors if you rename or move your documents.',
'header_text': project,
'header_logo_style': 'height: 3em',
'footer_logo_style': 'height: 3em',
} sphinx-reredirects-0.1.2/docs/faq.rst 0000664 0000000 0000000 00000002665 14431353004 0017573 0 ustar 00root root 0000000 0000000 FAQ
####
Aren't 301 redirects better?
****************************
Client-side redirects with meta refresh are okay for search engines, even the most ancient browsers, and users too.
|project| extension was created for tech writers who don't want or can't manage redirects with server-side 301 redirects. Generally, SEO consultants recommend server-side redirects created with ``.htaccess`` and similar files. However, many documentation is hosted as on static website hosting which doesn't support server-side redirects.
I know better how to write HTML redirect file
*********************************************
By default, created HTML redirect files contains ````.
If you want JavaScript redirection instead, wait longer, or whatever, set ``redirect_html_template`` option. This option should points to file inside source dir (directory containing ``conf.py``). For example::
redirect_html_template_file = "redirect.html.template"
Actual target URI requested in configuration is available under ``${to_uri}`` placeholder.
Why name "reredirects"?
***********************
Because the name "redirects" is already taken by `another `_ extension. Unfortunately, it doesn't fulfil our requirements (the most notable it doesn't support wildcards and placeholders). These were reasons why we decided to bring a new extension.
sphinx-reredirects-0.1.2/docs/index.rst 0000664 0000000 0000000 00000000146 14431353004 0020123 0 ustar 00root root 0000000 0000000 .. include:: ../README.rst
.. toctree::
:maxdepth: 2
:hidden:
install
usage
faq
rn sphinx-reredirects-0.1.2/docs/install.rst 0000664 0000000 0000000 00000000363 14431353004 0020463 0 ustar 00root root 0000000 0000000 Install and setup
#################
Perform::
pip3 install sphinx-reredirects
Then, open your ``conf.py`` and append ``sphinx_reredirects`` to the ``extensions`` list::
extensions = [
...
'sphinx_reredirects'
]
sphinx-reredirects-0.1.2/docs/logo.png 0000664 0000000 0000000 00000002221 14431353004 0017724 0 ustar 00root root 0000000 0000000 PNG
IHDR @ @ iq bKGD FIDATxMEh,MrQCQa6^Z`0H~s(W_y$.ތNw%&9ދضY\&8v?{^'x
=ٸ.hC%"L
~ѽ>;se7i| Ka
.)M,aB&,ZIr&Qfe)ܾVWT3
r#x^3xEd"`W<