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.

@stale stale bot added the inactive label Feb 18, 2022
@srenatus srenatus self-assigned this Apr 20, 2022
@stale stale bot removed the inactive label Apr 20, 2022
@srenatus srenatus added this to Backlog in Open Policy Agent via automation Apr 20, 2022
@srenatus srenatus moved this from Backlog to In Progress in Open Policy Agent Apr 20, 2022
@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 <stephan.renatus@gmail.com>
Open Policy Agent automation moved this from In Progress to Done Apr 21, 2022
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 <stephan.renatus@gmail.com>
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 <stephan.renatus@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

1 participant