{# NOTE(dhellmann): This file is not in a series directory, so we need to set the series name ourselves. #} {% set series = 'latest' %} {% set projects = PROJECT_DATA[series] %} {# Macro to generate redirects for anything under a specific directory to a given page, allowing the path to not have a trailing slash. Arguments: path -- the partial regex representing the input path (should not end in /) result -- the result pattern code -- the response code (defaults to 301) #} {% macro dir_to_page(path, result, code=301) -%} redirectmatch {{ code }} ^{{ path }}/?$ {{ result }} {%- endmacro %} {# Macro to generate redirects for anything under a given path to a given page, allowing the path to not have a trailing slash. Arguments: path -- the partial regex representing the input path (should not end in /) result -- the result pattern code -- the response code (defaults to 301) #} {% macro path_to_page(path, result, code=301) -%} redirectmatch {{ code }} ^{{ path }}($|/.*$) {{ result }} {%- endmacro %} {# Macro to generate redirects for a given path to a location under the RELEASED_SERIES. The result argument should be the sub-directory under RELEASED_SERIES. Arguments: path -- the partial regex representing the input path (should not end in /) result -- the subdirectory under /RELEASED_SERIES, (should start with /) code -- the response code (defaults to 301) #} {% macro path_to_released_series(path, result, code=301) -%} {{ path_to_page(path, '/' + RELEASED_SERIES + result, code) }} {%- endmacro %} {# Macro to generate redirects deep links under a page. A trailing catch-all pattern is appended and can be referenced in the result value. Arguments: path -- the partial regex representing the input path (should not end in /) result -- the result pattern (may include references to groups from path) code -- the response code (defaults to 301) #} {% macro deep_links(path, result, code=301) -%} redirectmatch {{ code }} ^{{ path }}(?![^/])/?(.*)$ {{ result }} {%- endmacro %} {# Macro to handle project renames. Arguments: old -- The previous name of the project. new -- The new name of the project. #} {% macro rename_project(old, new) -%} {{ deep_links('/' + old, '/' + new + '/$1') }} {%- endmacro %} # Redirect old top-level HTML pages to the version under most recent # full release. redirectmatch 301 ^/$ /{{ RELEASED_SERIES }}/ redirectmatch 301 ^/index.html$ /{{ RELEASED_SERIES }}/ redirectmatch 301 ^/openstack-projects.html$ /{{ RELEASED_SERIES }}/projects.html redirectmatch 301 ^/language-bindings.html$ /{{ RELEASED_SERIES }}/language-bindings.html # Redirect docs.openstack.org index.html subpage pointers to main page {{ dir_to_page('/install', '/' + RELEASED_SERIES + '/install/') }} {{ dir_to_page('/basic-install', '/' + RELEASED_SERIES + '/install/') }} {{ dir_to_page('/run', '/') }} redirect 301 /developer/index.html /{{ RELEASED_SERIES }}/projects.html {{ dir_to_page('/cli', '/') }} redirect 301 /api/api-specs.html https://docs.openstack.org/api-quick-start/index.html # Redirect old Admin Guides to new landing page {{ path_to_released_series('/admin-guide', '/admin/') }} {{ path_to_released_series('/user-guide-admin', '/admin/') }} # A doc generation bug resulted in Google indexing links containing "//", which cause # problems with linked content (images/css/etc). This rule generates a 301 redirect # for these links. # # details: https://bugs.launchpad.net/openstack-manuals/+bug/1288513 redirectmatch 301 (.*)//(.*) $1/$2 # Redirect networking-guide since it is now versioned {{ dir_to_page('/networking-guide', '/ocata/networking-guide/') }} # Redirect old releases content to new location {{ deep_links('/releases', 'http://releases.openstack.org/$1') }} # redirect all kuryr sub-repositories appropriately {{ deep_links('/developer/kuryr-(kubernetes|libnetwork|tempest-plugin)', '/kuryr-$1/latest/$2') }} # redirect all kolla sub-repositories appropriately {{ deep_links('/developer/kolla-kubernetes', '/kolla-kubernetes/latest/$1') }} # Redirect all openstack-ansible repositories appropriately {{ deep_links('/developer/(ansible-hardening|openstack-ansible-[^/]+)', '/$1/latest/$2') }} # Redirect some tripleo repositories appropriately {{ deep_links('/developer/(tripleo-common|tripleo-quickstart|tripleo-validations)', '/$1/latest/$2') }} # Redirect sahara repositories appropriately {{ deep_links('/developer/sahara-tests', '/sahara-tests/latest/$1') }} # Redirect removed user guide {{ path_to_released_series('/user-guide', '/user/') }} # Redirect removed ops guide {{ path_to_released_series('/ops-guide', '/admin/') }} {{ path_to_released_series('/ops', '/admin/') }} {{ path_to_released_series('/openstack-ops', '/admin/') }} {{ path_to_released_series('/trunk/openstack-ops', '/admin/') }} # Redirect api list {{ deep_links('/api', '/' + RELEASED_SERIES + '/api/') }} # Redirect missing project page for openstack-charms {{ path_to_page('/openstack-charms', '/charm-guide/') }} # Redirect old security index {{ path_to_page('/sec', '/security-guide/') }} {{ path_to_page('/security-guide/content', '/security-guide/') }} # Redirect to series indexes {{ path_to_page('/latest/configuration', '/' + SERIES_IN_DEVELOPMENT + '/configuration/') }} {{ path_to_page('/latest/install', '/' + SERIES_IN_DEVELOPMENT + '/install/') }} {{ path_to_released_series('/user', '/user/') }} {{ path_to_page('/latest/user', '/' + SERIES_IN_DEVELOPMENT + '/user/') }} {{ path_to_released_series('/admin', '/admin/') }} {{ path_to_page('/latest/admin', '/' + SERIES_IN_DEVELOPMENT + '/admin/') }} {{ dir_to_page('/latest', '/' + SERIES_IN_DEVELOPMENT + '/') }} # Redirect some pages users search for {{ path_to_page('/arch-design/content', '/arch-design/') }} {{ path_to_page('/image-guide/content', '/image-guide/') }} {{ path_to_released_series('/admin-guide-cloud', '/admin/') }} {{ path_to_page('/trunk/openstack-compute', '/nova/latest/admin/') }} redirect 301 /glossary/content/glossary.html /doc-contrib-guide/common/glossary.html {{ dir_to_page('/icehouse/training-guides', '/upstream-training/') }} # Redirect contributor-guide URL to doc-contrib-guide {{ deep_links('/contributor-guide', '/doc-contrib-guide/$1') }} # Redirect changed directory name in the Contributor Guide redirect 301 /doc-contrib-guide/ui-text-guidelines.html /doc-contrib-guide/ux-ui-guidelines/ui-text-guidelines.html redirect 301 /doc-contrib-guide/ui-text-guidelines /doc-contrib-guide/ux-ui-guidelines # Redirect deploy guides to their branch index. {# newton is a special case because it exists but is not maintained #} {{ dir_to_page('/project-deploy-guide/(newton)', '/$1/deploy/') }} {% for series in MAINTAINED_SERIES %} {{ dir_to_page('/project-deploy-guide/(' + series + ')', '/$1/deploy/') }} {% endfor %} # Redirect any deploy guide project directory back to the current stable index {{ path_to_released_series('/project-deploy-guide/?$', '/deploy/') }} # Redirect old install guide list pages to their new home {{ path_to_page('/(havana|icehouse|juno|kilo|mitaka)/install-guide', '/$1/') }} {{ dir_to_page('/project-install-guide/newton', '/newton/install/') }} {{ deep_links('/project-install-guide/ocata', '/ocata/install/$1') }} # Redirecting infra docs links to new location {{ deep_links('/infra/shade', '/shade/latest/$1') }} # Redirecting old project developer docs to the new layout. If a # project has an in-tree .htaccess file, assume it can handle the full # path in the redirect. Otherwise, redirect everything to the new # latest index.html. {% for project in projects|sort(attribute='name') -%} {# use separate rules for project.name$ and project.name/(.*)$ because some project names are prefixes of other project names (glance and glance_store) #} {%- if project.has_in_tree_htaccess %} {{ deep_links('/developer/' + project.name, '/' + project.name + '/latest/$1') }} {%- else %} {{ path_to_page('/developer/' + project.name, '/' + project.name + '/latest/') }} {%- endif %} {%- endfor %} # Redirect project contributor docs for stable series to latest redirectmatch 301 /([^/]+)/(?!latest)[^/]+/contributor(/.*)?$ /$1/latest/contributor$2 # Redirect old cli-reference to the OSC latest docs {{ path_to_page('/cli-reference', '/python-openstackclient/latest/') }} # Redirects from service-type to code-name {% for project in projects -%} {%- if project.type == 'service' and project.service_type and (project.service_type|lower != project.name) %} {# use separate rules for project.name$ and project.name/(.*)$ because some project names are prefixes of other project names (glance and glance_store) #} {{ path_to_page('/' + project.service_type|lower, '/' + project.name + '/latest/', 302) }} {%- endif %} {%- endfor %} # End service-type redirects # Redirect project-deploy-guide/code-name to project-deploy-guide/code-name/latest {% for project in projects -%} {%- if project.type == 'deployment' %} {{ dir_to_page('/project-deploy-guide/' + project.name, '/project-deploy-guide/' + project.name + '/latest/') }} {%- endif %} {%- endfor %} # End redirect project-deploy-guide # Redirects from code-name without a series to latest {% for repo in REGULAR_REPOS %} {{ dir_to_page('/' + repo.base, '/' + repo.base + '/latest/') }} {%- endfor %} # End latest code-name redirects # Redirects from infra code-name without a series to location {% for repo in INFRA_REPOS %} {{ dir_to_page('/' + repo.base, '/infra/' + repo.base + '/') }} {%- endfor %} # End infra code-name redirects # Redirects retired repos from code-name without a series to latest {% for repo in RETIRED_REPOS %} {{ dir_to_page('/' + repo.base, '/' + repo.base + '/latest/') }} {%- endfor %} # End latest code-name redirects # Redirects retired repos to https://opendev.org/openstack/REPO/src/branch/master/README.rst {% for repo in RETIRED_REPOS %} {{ path_to_page('/' + repo.base + '/latest', 'https://opendev.org/' + repo.name + '/src/branch/master/README.rst' ) }} {%- endfor %} # End retired repos redirects # Redirect https://docs.openstack.org/infra/zuul/feature/zuulv3/ to # https://zuul-ci.org/docs/zuul redirectmatch 301 /infra/zuul/feature/zuulv3(.*)$ https://zuul-ci.org/docs/zuul$1 # End redirect zuul/feature/zuulv3 # Redirect zuul to zuul-ci.org {{ deep_links('/infra/zuul', 'https://zuul-ci.org/docs/zuul/$1') }} # End redirect zuul to zuul-ci.org # Redirect https://docs.openstack.org/infra/nodepool/feature/zuulv3/ to # https://zuul-ci.org/docs/nodepool redirectmatch 301 /infra/nodepool/feature/zuulv3(.*)$ https://zuul-ci.org/docs/nodepool$1 # End redirect nodepool/feature/zuulv3 # Redirect nodepool to zuul-ci.org {{ deep_links('/infra/nodepool', 'https://zuul-ci.org/docs/nodepool/$1') }} # End redirect zuul to zuul-ci.org # Redirect zuul-base-jobs to zuul-ci.org {{ deep_links('/infra/zuul-base-jobs', 'https://zuul-ci.org/docs/zuul-base-jobs/$1') }} # End redirect zuul-base-jobs to zuul-ci.org # Redirect zuul-jobs to zuul-ci.org {{ deep_links('/infra/zuul-jobs', 'https://zuul-ci.org/docs/zuul-jobs/$1') }} # End redirect zuul-jobs to zuul-ci.org # Redirect zuul-sphinx to zuul-ci.org {{ deep_links('/infra/zuul-sphinx', 'https://zuul-ci.org/docs/zuul-sphinx/$1') }} # End redirect zuul-sphinx to zuul-ci.org # Redirect from python-openstacksdk to openstacksdk {{ rename_project('python-openstacksdk', 'openstacksdk') }} # End redirect for openstacksdk # Redirect from monasca to monasca-api {{ rename_project('monasca', 'monasca-api') }} # End redirect for monasca-api # Redirect outdated bare metal installation guide {{ deep_links('/project-install-guide/baremetal/draft', '/ironic/latest/install/$1') }} # End redirect outdated bare metal installation guide # Redirect https://docs.openstack.org/infra/bindep to # https://docs.opendev.org/opendev/bindep {{ deep_links('/infra/bindep', 'https://docs.opendev.org/opendev/bindep/latest/$1') }} # End redirect bindep # Redirect https://docs.openstack.org/infra/git-review to # https://docs.opendev.org/opendev/git-review {{ deep_links('/infra/git-review', 'https://docs.opendev.org/opendev/git-review/latest/$1') }} # End redirect git-review # Redirect https://docs.openstack.org/infra/manual to # https://docs.opendev.org/opendev/infra-manual {{ deep_links('/infra/manual', 'https://docs.opendev.org/opendev/infra-manual/latest/$1') }} # End redirect infra-manual # Redirect https://docs.openstack.org/infra/system-config to # https://docs.opendev.org/opendev/system-config {{ deep_links('/infra/system-config', 'https://docs.opendev.org/opendev/system-config/latest/$1') }} # End redirect system-config # Redirect https://docs.openstack.org/python-tempestconf to # https://docs.opendev.org/openinfra/python-tempestconf {{ deep_links('/python-tempestconf', 'https://docs.opendev.org/openinfra/python-tempestconf/$1') }} # End redirect python-tempestconf # Redirect https://docs.openstack.org/refstack to # https://docs.opendev.org/openinfra/refstack {{ deep_links('/refstack', 'https://docs.opendev.org/openinfra/refstack/$1') }} # End redirect refstack # Redirect 2023.1.antelope, 2023.2.bobcat to 2023.1, 2023.2 respectively {{ deep_links('/2023.1.antelope', '/2023.1/$1') }} {{ deep_links('/2023.2.bobcat', '/2023.2/$1') }} # End Redirect 2023.1.antelope, 2023.2.bobcat