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

Docs: Fixed broken template links, fixed script versions #662

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

gaurav-nelson
Copy link
Contributor

Fixes #576

I see that generated was removed in #439 which I am think was caused by changes in docsify library. Therefore, I've updated the script tags to load a fixed version so that it doesn't happen again.

@@ -10,7 +10,7 @@ KubeLinter includes the following built-in checks:

**Remediation**: Where possible, remove create access to pod objects in the cluster.

**Template**: [access-to-resources](templates.md#access-to-resources)
**Template**: [access-to-resources](generated/templates.md#access-to-resources)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure how GitHub is handling the links. I've built the site locally with docsify and used docsify serve ./docs command to check.

For example, go to https://stackblitz.com/~/github.com/gaurav-nelson/kube-linter/tree/fix-template-links and run npm i docsify-cli and then docsify server ./docs commands to check.

Copy link
Collaborator

@janisz janisz Nov 22, 2023

Choose a reason for hiding this comment

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

Ah, that's how it's done. How about keeping it working on github and docksify by adding

relativePath: true

in

window.$docsify = {
name: 'KubeLinter',
logo: 'https://raw.githubusercontent.com/stackrox/kube-linter/main/images/logo/KubeLinter-vertical.svg',
coverpage: false,

Then we only need to change index.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this locally. It fixes the check and template links. But if you click another topic, for example, Using KubeLinter it tries to open http://localhost:3000/#/generated/using-kubelinter 404.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch! So we need to change index and https://github.com/stackrox/kube-linter/blob/553365517c108e7cb200af7d98527b8716e236ac/docs/_sidebar.md to use absolute paths. Then it will not work on github and IDE but probably it's fine as nobody will use this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried it locally, changed the links for:

  • Checks to checks.md
  • Templates to templates.md

But then we get 404 with http://localhost:3000/#/templates when we click the links from sidebar. However, if we go to http://localhost:3000/#/generated/templates and then click the sidebar link it works fine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, it's working for me with this patch

diff --git a/docs/_sidebar.md b/docs/_sidebar.md
index 3457af1..3412f76 100644
--- a/docs/_sidebar.md
+++ b/docs/_sidebar.md
@@ -1,5 +1,5 @@
 * [Introduction](/)
-* [Using KubeLinter](using-kubelinter.md)
-* [Configuring KubeLinter](configuring-kubelinter.md)
-* [KubeLinter checks](generated/checks.md)
-* [KubeLinter templates](generated/templates.md)
\ No newline at end of file
+* [Using KubeLinter](/using-kubelinter.md)
+* [Configuring KubeLinter](/configuring-kubelinter.md)
+* [KubeLinter checks](/generated/checks.md)
+* [KubeLinter templates](/generated/templates.md)
diff --git a/docs/index.html b/docs/index.html
index dc7b2eb..deab721 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -27,6 +27,7 @@
         errorText  : 'Error',
         successText: 'Copied'
       },
+      relativePath: true,
       'flexible-alerts': {
         style: 'flat'
       },

@janisz janisz self-requested a review November 21, 2023 15:23
@janisz janisz added bug Something isn't working documentation Improvements or additions to documentation labels Nov 23, 2023
@janisz
Copy link
Collaborator

janisz commented Dec 1, 2023

@gaurav-nelson I've fixed this on your PR. Could you check. It's working for me

@janisz janisz requested a review from dhaus67 December 1, 2023 19:09
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
@janisz janisz merged commit e5da0a9 into stackrox:main Dec 5, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Template links are broken
2 participants