Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate redirects for latest plugin and module pages #266

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

oraNod
Copy link
Collaborator

@oraNod oraNod commented Dec 18, 2024

This PR is a follow on to #261 and should be rebased on top of those changes before merge.

Additionally, this PR is in draft state because it is an alternative proposal to adding a Sphinx extension to handle redirects for latest urls in the ansible/ansible-documentation repo: ansible/ansible-documentation#2266

Overview of the changes

Similarly to the consolidation of the 2.x redirects in PR #261 these changes remove all the individual redirect rules that point pages in the plugins and modules paths to the docs.ansible.com/collections.html page. This consolidation eliminates the maintenance burden of all the rules in the ansible/11/.htaccess configuration.

With the changes in this PR, all pages in the modules path get redirected to collections.html.

For pages in the plugins path, only pages under a subdirectory get redirected to collections.html. For example:

  • plugins/become/doas.html redirects to collections.html because the page is under the become subdirectory.
  • plugins/callback/tree.html redirects to collections.html because the page is under the callback subdirectory.
  • plugins/become.html and plugins/callback.html do not redirect because those pages exist on latest: https://docs.ansible.com/ansible/latest/plugins/

An alternative approach might be to use a negative lookahead rule such as this one:

RedirectMatch permanent "^/ansible/(devel|latest)/plugins/(?!action\.html|become\.html|cache\.html|callback\.html|cliconf\.html|connection\.html|docs_fragment\.html|filter\.html|httpapi\.html|inventory\.html|lookup\.html|module\.html|module_util\.html|netconf\.html|plugins\.html|shell\.html|strategy\.html|terminal\.html|test\.html|vars\.html)/(.+)\.html$" "/collections.html"

A rule like this is more explicit about which pages should get redirected but that seems unnecessary.

Alternative to the Sphinx extension

As mentioned above, the changes here offer an alternative to replacing latest redirect rules with a Sphinx extension in the docs repo: ansible/ansible-documentation#2266

The Sphinx extension is capable of generating html pages that redirect the pages under plugins and modules to the corresponding collection page, which is arguably a better user experience. Likewise using the Sphinx extension as a means to replace the latest redirect rules means that we won't need to create redirects in the Read The Docs project to migrate to that platform. The extension will handle the redirects as part of the doc build instead.

@oraNod oraNod requested a review from samccann December 18, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant