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

Add the option to use a logo for the top left site title #249

Closed
wants to merge 1 commit into from

Conversation

nickjwhite
Copy link
Contributor

This fixes issue #81, but it does so slightly differently. It replaces the site title with a logo, in the navigation section, if Site.Params.Logo is set. If not it just continues to print the title, as it has up 'til now. Rather than Lithium's approach of having dimensions set under the logo parameter (see https://github.com/jrutheiser/hugo-lithium-theme/blob/master/exampleSite/config.toml) I just went for simplicity, figuring people would be happy to just set the dimensions in the image, or CSS, themselves.

This is my first hugo theme adjustment, so please check it over for any stupid mistakes!

@@ -1,7 +1,11 @@
<nav class="pv3 ph3 ph4-ns" role="navigation">
<div class="flex-l justify-between items-center center">
<a href="{{ .Site.BaseURL }}" class="f3 fw2 hover-white no-underline white-90 dib">
{{ if .Site.Params.Logo }}
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this. Using with would make this a tiny bit less verbose (still for best practices promoting):

{{ with .Site.Params.Logo }}
  <img src="{{ relURL . }}" alt="{{ $.Site.Title }}" />
{{ else }}
   {{ .Site.Title }}
{{ end }}

@mountainbug95 mountainbug95 mentioned this pull request Jun 3, 2020
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.

2 participants