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: example to show separate logo file on subpages #969

Open
textractor opened this issue Dec 11, 2024 · 7 comments
Open

docs: example to show separate logo file on subpages #969

textractor opened this issue Dec 11, 2024 · 7 comments
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@textractor
Copy link

I overrode the partial as documented here. I just copied the existing partial in the Relearn doc site to my layouts/partials/ and substituted an image tag for the svg:

 1 <a id="R-logo" href="{{ partial "permalink.gotmpl" (dict "to" .Site.Home) }}">
 2 <img src="octobuddy_purple_fade.png" alt="MyDecisive Octobuddy logo">
 3 {{ .Site.Params.linkTitle | default .Site.Title }}
 4           </a>

It shows up nicely on the home page, but is a broken link on all of the others. How do I get it to show up on all of the other pages?

@textractor
Copy link
Author

Apologies if this should have gone in discussions, I just noticed that.

@McShelby McShelby added the support Request for achieving a specific goal label Dec 11, 2024
@McShelby McShelby added this to the 7.2.2 milestone Dec 11, 2024
@McShelby McShelby added the documentation Improvements or additions to documentation label Dec 11, 2024
@McShelby
Copy link
Owner

Hi, the documentation lacks an example for this. Try this

<a id="R-logo" href="{{ partial "permalink.gotmpl" (dict "to" .Site.Home) }}">
<img src="{{"octobuddy_purple_fade.png" | relURL}}" alt="MyDecisive Octobuddy logo">
{{ .Site.Params.linkTitle | default .Site.Title }}
</a>

@textractor
Copy link
Author

Perfect, makes sense and works. Thank you!

@McShelby
Copy link
Owner

I'll add documentation for this.

@McShelby McShelby reopened this Dec 11, 2024
@McShelby McShelby self-assigned this Dec 11, 2024
@McShelby McShelby removed the support Request for achieving a specific goal label Dec 11, 2024
@McShelby McShelby changed the title Logo shows only on home page, broken on others docs: example to show separate logo file on subpages Dec 11, 2024
@textractor
Copy link
Author

textractor commented Dec 11, 2024

Unfortunately, while that fix worked locally, on push to GitHub the rendered site there shows logos as broken now, even on the home page.

@textractor
Copy link
Author

Looks like in GitHub pages it renders like this, with the repo prepended to path:

<a id="R-logo" href="/mdai-docs-v2/index.html">
<img src="/mdai-docs-v2/octobuddy_purple_fade.png" alt="MyDecisive Octobuddy logo">
</a>

Locally I get this:

<a id="R-logo" href="/index.html">
<img src="/octobuddy_purple_fade.png" alt="MyDecisive Octobuddy logo">
 
          </a>

I don't understand why the path difference, and maybe that's beyond the scope of the theme. Or is there a way to code this in the theme so that it works right on GitHub?

@McShelby
Copy link
Owner

Both is correct behavior for the code I've provided under the assumption that the image belongs to your Hugo project and resides in your static directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants