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

feat: improve link handling #3

Merged
merged 1 commit into from
Apr 4, 2023
Merged

feat: improve link handling #3

merged 1 commit into from
Apr 4, 2023

Conversation

aepfli
Copy link
Member

@aepfli aepfli commented Apr 4, 2023

Hugo could be better when linking markdown files if they are outside their own folder. With this improvement, we will fetch all relative links, even with .md, and generate their url different than the originial version.

This change now also allows links to .md files within the links, so we don't need to care about this anymore.

In Hugo you can write documentation with two different naming/structuring approaches:

  1. <docName>/_index.md
  2. <docName>.md

The problem is that links from files within the second approach could be simpler. Locally and in the Markdown space, they're in the same folder. But when Hugo renders them, there is a folder level in between.

With this approach, we're changing how hugo renders relative files. Rather than blindly using the link for pages within the documentation, we search for that page, and take the link from this page, generate via Hugo. This way we will always have the right directory levels, for markdown and for hugo

relates: keptn/lifecycle-toolkit#1177

Hugo could be better when linking markdown files if they are outside their own folder. With this improvement, we will fetch all relative links, even with `.md,` and generate their url different than the [originial version](https://gohugo.io/templates/render-hooks/#link-with-title-markdown-example).

This change now also allows links to `.md` files within the links, so we don't need to care about this anymore.

In Hugo you can write documentation with two different naming/structuring approaches:
1. `<docName>/_index.md`
2. `<docName>.md`

The problem is that links from files within the second approach could be simpler. Locally and in the Markdown space, they're in the same folder. But when Hugo renders them, there is a folder level in between.

With this approach, we're changing how hugo renders relative files. Rather than blindly using the link for pages within the documentation, we search for that page, and take the link from this page, generate via Hugo. This way we will always have the right directory levels, for markdown and for hugo

relates: keptn/lifecycle-toolkit#1177

Signed-off-by: Simon Schrottner <[email protected]>
@aepfli aepfli merged commit 7e0be2d into main Apr 4, 2023
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.

1 participant