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

Ability to add a site logo? #205

Closed
Ben-Chapman opened this issue Mar 27, 2020 · 4 comments
Closed

Ability to add a site logo? #205

Ben-Chapman opened this issue Mar 27, 2020 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Ben-Chapman
Copy link

Hi there, thanks for the work on this theme, it's really fantastic.

I've not been able to find a way to add a logo image within this theme. Ideally I would like to replace the site title (upper left corner) with an image. Everything I've tried so far has not been successful.

Is this something which is possible?

@andyjenkins1
Copy link

Good idea!.

@Ben-Chapman
Copy link
Author

I'm still working on this, and the best I've been able to come up with is to override the default CSS to force an image into the home-profile section of the page:

Screenshot_20200330_115258

To accomplish this, I have the following set in config.toml:

[params.home]
        # Home Page Profile
        [params.home.profile]
        enable = true
        # Gravatar Email for preferred avatar in home page
        gravatarEmail = ""
        # URL of avatar shown in home page
        # avatarURL = ""
        # subtitle shown in home page
        # subtitle = "This is My New Hugo Site"
        # whether to use typeit animation for subtitle
        typeit = false

And have the following CSS in config/css/_custom.scss:

// Site Logo
.home .home-profile {
    background-image: url("/images/demo-logo.png");
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    height: 5rem;  // Adjust as needed
    width: 20rem;  // Adjust as needed
}

I have no doubt this approach and my CSS goes against many best practices, but does seem to be working reliably across desktop, mobile and tablet.

@Ben-Chapman
Copy link
Author

Ah! Digging through the example site config, I came across a code comment which gave some insight into placing a logo into the site header. It looks like you can do something like:

[menu]
  [[menu.main]]
    identifier = "posts"
    # you can add extra information before the name (HTML format is allowed), such as icons
    pre = '<a href="/"><img src="/images/logo.png" alt="Site Logo Test"></a>'
    name = "Posts"
    url = "/posts/"
    # title will be shown when you hover on this menu link
    title = ""
    weight = 1

It's still not exactly what I'm looking for, but getting closer

@dillonzq
Copy link
Owner

Added in #252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants