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

Security alias again redirects to Chinese #18896

Closed
2 tasks
zacharysarah opened this issue Jan 28, 2020 · 3 comments
Closed
2 tasks

Security alias again redirects to Chinese #18896

zacharysarah opened this issue Jan 28, 2020 · 3 comments

Comments

@zacharysarah
Copy link
Contributor

Bug report

What's the problem?

Visiting https://kubernetes.io/security/ redirects visitors from English to Chinese.

This issue has the same cause as #18691 and #18129.

This behavior was originally fixed by #18694 (albeit for unrelated reasons) and re-introduced by #18727.

Why did this happen?

Hugo's alias handling determines this behavior.

How Hugo handles aliases

Hugo features an alias attribute in the front matter of Markdown files. Aliases serve as convenient redirects. Per Hugo documentation for aliases, aliases can use absolute or relative paths:

Aliases comes in two forms:

  1. Starting with a / meaning they are relative to the BaseURL, e.g. /posts/my-blogpost/
  2. They are relative to the Page they’re defined in, e.g. my-blogpost or even something like ../blog/my-blogpost (new in Hugo 0.55).

Importantly, Hugo doesn't throw errors or fail builds for competing aliases:

Aliases are rendered before any content are rendered and therefore will be overwritten by any content with the same location.

That describes the behavior we're seeing here:

  1. Hugo first renders the /security/ alias (the leading slash creates an absolute path) for English content.
  2. Hugo subsequently renders the /security/ alias for Chinese content, overwriting the absolute path.

Bug fix

  1. Remove leading slashes from aliases in these localized files:
  1. Document that localizations must remove leading slashes from aliases.
@zacharysarah
Copy link
Contributor Author

Localization teams, please read. 👀

@kubernetes/sig-docs-zh-owners
@kubernetes/sig-docs-de-owners
@kubernetes/sig-docs-es-owners
@kubernetes/sig-docs-fr-owners
@kubernetes/sig-docs-hi-owners
@kubernetes/sig-docs-id-owners
@kubernetes/sig-docs-it-owners
@kubernetes/sig-docs-ja-owners
@kubernetes/sig-docs-ko-owners
@kubernetes/sig-docs-pl-owners
@kubernetes/sig-docs-pt-owners
@kubernetes/sig-docs-ru-owners
@kubernetes/sig-docs-vi-owners

@zacharysarah
Copy link
Contributor Author

Fixed by #18895

/close

@k8s-ci-robot
Copy link
Contributor

@zacharysarah: Closing this issue.

In response to this:

Fixed by #18895

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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

No branches or pull requests

2 participants