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

Change absolute paths to relative paths in docs #4698

Merged
merged 1 commit into from
Mar 23, 2023

Conversation

Atish-iaf
Copy link
Contributor

@Atish-iaf Atish-iaf commented Mar 11, 2023

No description provided.

@Atish-iaf
Copy link
Contributor Author

/skip-all

@@ -73,7 +73,7 @@ you can deploy Antrea as follows:
```

To deploy the latest version of Antrea (built from the main branch), use the
checked-in [deployment yaml](/build/yamls/antrea-aks.yml):
checked-in [deployment yaml](https://github.com/antrea-io/antrea/blob/main/build/yamls/antrea-aks.yml):
Copy link
Contributor

@luolanzone luolanzone Mar 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe @tnqn mentioned that the root cause is we should use relative path in the issue comment.
you should update it as following one.

Suggested change
checked-in [deployment yaml](https://github.com/antrea-io/antrea/blob/main/build/yamls/antrea-aks.yml):
checked-in [deployment yaml](./build/yamls/antrea-aks.yml):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't work because it expands to wrong path and searches for the file in antrea website repo.
Actually any relative path wouldn't work here because these files (mostly yaml) are not present in antrea website github repo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If relative path has to work , the folder "build/yamls/" needs to be created on https://antrea.io and then each file needs to be available there, otherwise will have to use absolute GitHub path

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt this is the right way to fix the issue. If you change it to a link, then when you have any changes on a local file, it will jump to a website link which point to a main branch file. I don't think this is what we expected.
Let's see what's @antoninbas and @tnqn 's comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the docs should use relative paths. The link should be ../build/yamls/antrea-aks.yml here

The right way to fix it is in the scripts which generate the website source (they should do link substitution when applicable: ../build/yamls/antrea-aks.yml -> https://github.com/antrea-io/antrea/blob/<CORRECT TAG>/build/yamls/antrea-aks.yml)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, changed to use relative path.

@Atish-iaf Atish-iaf force-pushed the FixLinksInDocuments branch 2 times, most recently from e238b07 to 464d7f6 Compare March 17, 2023 10:53
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while this change is correct, and needed IMO, it doesn't by itself fix issue #4353, and so adding Fixes #4353 to the commit message is incorrect.

in addition to this change, the https://github.com/antrea-io/website/blob/main/scripts/pkg/update-docs.go logic also needs to be improved to translate links to the build/ directory into absolute http links, as I described in a previous comment.

@Atish-iaf
Copy link
Contributor Author

while this change is correct, and needed IMO, it doesn't by itself fix issue #4353, and so adding Fixes #4353 to the commit message is incorrect.

in addition to this change, the https://github.com/antrea-io/website/blob/main/scripts/pkg/update-docs.go logic also needs to be improved to translate links to the build/ directory into absolute http links, as I described in a previous comment.

Hi @antoninbas, thanks for your suggestions. I have few questions.

  1. Could you please help me understand why changes made in this PR are needed? We can skip this PR and make changes in website repo to translate existing relative links to appropriate absolute links. Also, the existing relative links works fine when inside local antrea repo, so why to add .. as prefix in existing relative links. Both will work same when inside local antrea repo.
  2. At few places in documentation (https://github.com/antrea-io/antrea/blob/main/docs/aks-installation.md#:~:text=To%20deploy%20the%20latest%20version%20of%20Antrea%20(built%20from%20the%20main%20branch)%2C%20use%20the%20checked%2Din%20deployment%20yaml%3A) link should be to the latest antrea.yml, so at these places can we put absolute link to antrea.yml from main branch of antrea github repo? (Here, I am saying not to translate)

@antoninbas
Copy link
Contributor

  1. It is not strictly needed for these links to the build/ directory (since we have to transform them manually anyway). However, as a rule, the website scripts don't render absolute documentation links correctly (by absolute, I mean like /docs/foo.md, and not URLs) and it is safer to always stick to relative links (docs/foo.md, ../docs/foo.md). Ideally we would have a lint rule to prevent absolute markdown links (i.e., links starting with a /). It should be possible for us to add a custom rule to markdownlint.
  2. No, it is not correct to always point to the main version. The antrea.io website includes a different version of the documentation for each recent release (check https://antrea.io/docs/v1.10.0/). When visiting the documentation for an older release, links should point to the correct version of the manifests (and not point to main). This is why I described the "correct link substitution" in Change absolute paths to relative paths in docs #4698 (comment).

Signed-off-by: Kumar Atish <atish.iaf@gmail.com>
@Atish-iaf Atish-iaf changed the title Fix wrong links in docs Change absolute paths to relative paths in docs Mar 23, 2023
@antoninbas
Copy link
Contributor

/skip-all

@antoninbas antoninbas merged commit 605a9d6 into antrea-io:main Mar 23, 2023
jainpulkit22 pushed a commit to urharshitha/antrea that referenced this pull request Apr 28, 2023
Signed-off-by: Kumar Atish <atish.iaf@gmail.com>
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.

5 participants