Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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.

**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 <[email protected]>
@janisz janisz force-pushed the fix-template-links branch from e726dba to f082060 Compare December 1, 2023 19:11
@janisz janisz merged commit e5da0a9 into stackrox:main Dec 5, 2023
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