diff --git a/doc/contributor-guide/source/doc-tools/template-generator.rst b/doc/contributor-guide/source/doc-tools/template-generator.rst index a75dde1f96..d8fe87265b 100644 --- a/doc/contributor-guide/source/doc-tools/template-generator.rst +++ b/doc/contributor-guide/source/doc-tools/template-generator.rst @@ -142,6 +142,10 @@ include a link to that documentation on the templated landing pages. ``has_admin_guide`` produces a link to docs.o.o/name/latest/admin/ +``has_in_tree_htaccess`` + enables full redirects to old paths, not just to the top of + /name/latest/ + .. note:: The documentation associated with the flags must exist before the diff --git a/www/.htaccess b/www/.htaccess index b981defb59..3c408fc1e6 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -60,9 +60,17 @@ redirectmatch 301 "^/project-install-guide/ocata/(.*)$" /ocata/install/$1 # Redirecting infra docs links to new developer location redirectmatch 301 "^/infra/shade(.*)$" /developer/shade$1 -# Redirecting old project developer docs to the new project home pages -# while leaving the index / project list page as it is. -redirectmatch 301 "^/developer/([^/]+)/.*$" /$1/latest/ +# 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') -%} +{%- if project.has_in_tree_htaccess %} +redirectmatch 301 "^/developer/{{project.name}}/(.*)$" /{{project.name}}/latest/$1 +{%- else %} +redirectmatch 301 "^/developer/{{project.name}}/.*$" /{{project.name}}/latest/ +{%- endif %} +{%- endfor %} # Redirect old cli-reference to the OSC latest docs redirectmatch 301 "^/cli-reference/.*$" /python-openstackclient/latest/ diff --git a/www/project-data/schema.yaml b/www/project-data/schema.yaml index c7a599a772..b37a7f9f03 100644 --- a/www/project-data/schema.yaml +++ b/www/project-data/schema.yaml @@ -41,3 +41,5 @@ items: type: boolean has_user_guide: type: boolean + has_in_tree_htaccess: + type: boolean