Skip to content

Conversation

@dvdksn
Copy link
Contributor

@dvdksn dvdksn commented Jan 9, 2024

  • Replaces fix: documentation broken links in production. #4243

  • closes fix: documentation broken links in production. #4243

  • Added a Markdown rendering hook for Hugo to handle relative links like they're handled on GitHub. This means you'll be able to view the source markdown files on GitHub directly and still follow links like they work when viewing the deployed HTML pages.

  • Fixed broken internal links that weren't being detected before as a result of using absolute links.

  • Simplified the documentation build steps by setting a static base url in the Hugo configuration.

The third change is optional, but makes things a little bit simpler. Simple is good I think. A side-effect of this change is that docs will be served locally on a sub-path (localhost:1313/distribution) to mimic the production deployment.

{{- if (strings.HasPrefix .Destination "http") -}}
<a href="{{ safe.URL .Destination }}" target="_blank">{{ safe.HTML .Text }}</a>
{{- else -}}
<a href="{{ ref .Page .Destination | safe.URL }}">{{ safe.HTML .Text }}</a>
Copy link

Choose a reason for hiding this comment

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

Nice.

@@ -1,4 +1,4 @@
baseURL: /
baseURL: https://distribution.github.io/distribution
Copy link
Member

@milosgajdos milosgajdos Jan 10, 2024

Choose a reason for hiding this comment

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

Hmm, this is interesting. What does this change so? Is it to make the GH changes work with the new hooks?

Choose a reason for hiding this comment

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

No, it's actually how this should've been. Think of this as the intended absolute url for the deploy; in local deploy it overrides for dev reasons, but this is supposed to be the end host + url.

@dvdksn
Copy link
Contributor Author

dvdksn commented Jan 10, 2024

I just noticed that docs-test is broken now after setting the base URL in the configuration. Looking into a fix.

@dvdksn dvdksn force-pushed the docs-fix-link-rendering branch from 7a85390 to b193fae Compare January 10, 2024 08:53
@dvdksn dvdksn requested a review from milosgajdos January 10, 2024 08:54
@dvdksn dvdksn force-pushed the docs-fix-link-rendering branch from b193fae to da6a7d0 Compare January 10, 2024 08:57
@milosgajdos milosgajdos requested a review from thaJeztah January 10, 2024 14:38
@milosgajdos
Copy link
Member

I just noticed that docs-test is broken now after setting the base URL in the configuration. Looking into a fix.

@dvdksn I'm assuming you found the fix?

@dvdksn
Copy link
Contributor Author

dvdksn commented Jan 13, 2024

@milosgajdos yes!

Copy link
Member

@milosgajdos milosgajdos left a comment

Choose a reason for hiding this comment

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

LGTM. Can you squash?

PTAL @thaJeztah

Update the formatting of links and add a Markdown render hook for
handling relative internal links. Cross-references between markdown
files are now resolved the same way in both GitHub and Hugo.

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@dvdksn dvdksn force-pushed the docs-fix-link-rendering branch from da6a7d0 to 5e75227 Compare January 14, 2024 20:34
@dvdksn
Copy link
Contributor Author

dvdksn commented Jan 14, 2024

squashed @milosgajdos

@Jamstah
Copy link
Collaborator

Jamstah commented Jan 15, 2024

Our doc system has got complicated enough that I think we need an overview for developers - can we put a README.md, CONTRIBUTING.md, or BUILDING.md into the docs folder with some basic "how to run locally" type instructions?

@Jamstah
Copy link
Collaborator

Jamstah commented Jan 15, 2024

Perhaps some docs targets in the makefile too?

@thaJeztah
Copy link
Member

Yeah we probably could add a make target or something to make it more discoverable.

w.r.t. this PR; I think this PR should make life easier, as contributors can create links "as usual" (the way documents can be linked on GitHub), and those links should work both on GitHub (not as pretty as the generated docs, but "functional") and in the generated docs.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@Jamstah Jamstah left a comment

Choose a reason for hiding this comment

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

Makefile and developer doc could be in a separate pr, so green tick for this.

@milosgajdos milosgajdos merged commit 01b4555 into distribution:main Jan 17, 2024
@dvdksn dvdksn deleted the docs-fix-link-rendering branch January 17, 2024 06:32
@ferringb
Copy link

Belated, but thanks for the resolution. Also, nice trick for having GH links work- I'll use that in the future ;)

@thaJeztah
Copy link
Member

I hate "+1"'s but making an exception here and adding my "+1"; happy that we found a good solution for this!! Kudos to @dvdksn ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants