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

website: keep previous patch release versions' URLs intact #4225

Closed
srenatus opened this issue Jan 14, 2022 · 3 comments · Fixed by #4598
Closed

website: keep previous patch release versions' URLs intact #4225

srenatus opened this issue Jan 14, 2022 · 3 comments · Fixed by #4598

Comments

@srenatus
Copy link
Contributor

Currently, whenever there's a patch release, like 0.36.1, that becomes the only displayed docs version in the version picker:

image

That's fine. However, we also stop generating website content for the previous versions, so 0.36.0 disappears: https://www.openpolicyagent.org/docs/v0.36.0/ is a 404 now.

It would be preferable if those URLs stayed intact.

This could be achieved by some clever redirect logic, or by checking out all the releases in load-docs.sh, and only adding the latest ones of each minor series to the releases.yaml file.

💭 I think the redirect approach would be preferable, since there's less static content to process. But I also don't know off-hand how to get that done.

@srenatus
Copy link
Contributor Author

It looks like we could achieve the redirect using a hugo feature: Aliases:

For every file docs/website/generated/docs/v*/*.md that load-docs.sh creates, say, docs/website/generated/docs/v0.x.y/envoy-primer.md,

  • extract the semver v0.x.y from the path,
  • for every v0.x.a with a < y, (e.g. v0.36.0, v0.36.1, v0.36.2 if x is 36 and y is 3)
  • add a modified path, /docs/v0.x.a/something/ to the original something.md's frontmatter yaml.

In that example, we'd add

aliases: [/docs/v0.36.0/envoy-primer/, /docs/v0.36.1/envoy-primer/, /docs/v0.36.2/envoy-primer/]

to docs/website/generated/docs/v0.36.3/envoy-primer.md.

Generating the HTML via hugo, it would create stubs for every alias directory, as described here.

@stale
Copy link

stale bot commented Feb 18, 2022

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.

@srenatus
Copy link
Contributor Author

I think I've found a simpler way: #4598 has the wip.

srenatus added a commit to srenatus/opa that referenced this issue Apr 21, 2022
…elease

This will result in the _redirects page having a bunch of entries like this:

    # previous minor versions
    /docs/v0.38.0/* /docs/v0.38.1/:splat
    /docs/v0.37.1/* /docs/v0.37.2/:splat
    /docs/v0.37.0/* /docs/v0.37.2/:splat
    /docs/v0.36.0/* /docs/v0.36.1/:splat
    /docs/v0.34.1/* /docs/v0.34.2/:splat
    /docs/v0.34.0/* /docs/v0.34.2/:splat
    /docs/v0.33.0/* /docs/v0.33.1/:splat
    /docs/v0.32.0/* /docs/v0.32.1/:splat

Fixes open-policy-agent#4225.

Signed-off-by: Stephan Renatus <[email protected]>
srenatus added a commit that referenced this issue Apr 21, 2022
…elease (#4598)

This will result in the _redirects page having a bunch of entries like this:

    # previous minor versions
    /docs/v0.38.0/* /docs/v0.38.1/:splat
    /docs/v0.37.1/* /docs/v0.37.2/:splat
    /docs/v0.37.0/* /docs/v0.37.2/:splat
    /docs/v0.36.0/* /docs/v0.36.1/:splat
    /docs/v0.34.1/* /docs/v0.34.2/:splat
    /docs/v0.34.0/* /docs/v0.34.2/:splat
    /docs/v0.33.0/* /docs/v0.33.1/:splat
    /docs/v0.32.0/* /docs/v0.32.1/:splat

Fixes #4225.

Signed-off-by: Stephan Renatus <[email protected]>
rokkiter pushed a commit to rokkiter/opa that referenced this issue Apr 26, 2022
…elease (open-policy-agent#4598)

This will result in the _redirects page having a bunch of entries like this:

    # previous minor versions
    /docs/v0.38.0/* /docs/v0.38.1/:splat
    /docs/v0.37.1/* /docs/v0.37.2/:splat
    /docs/v0.37.0/* /docs/v0.37.2/:splat
    /docs/v0.36.0/* /docs/v0.36.1/:splat
    /docs/v0.34.1/* /docs/v0.34.2/:splat
    /docs/v0.34.0/* /docs/v0.34.2/:splat
    /docs/v0.33.0/* /docs/v0.33.1/:splat
    /docs/v0.32.0/* /docs/v0.32.1/:splat

Fixes open-policy-agent#4225.

Signed-off-by: Stephan Renatus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant