Title Logo and Text
I would like to add a site logo to the title while maintaining the site title text.
So far, with #71, the site title can be displayed as a logo but then the text is disabled.
Therefore, I made an attempt by overriding _include/title.html as
<img src="https://img.mmcesim.org/logo/mmCEsim_logo_256.png" width="48">
<pre> </pre>
mmCEsim
And it now looks satisfactory. (Visit mmcesim.org as a demonstration.)
So I am thinking about adding a configuration to have the title logo and text in the same place.
Hi @Teddy-van-Jerry, thanks for submitting an issue. I'm a bit confused what the request is - overriding the _includes/title.html like you've done is the way to have a title logo and text. What are you looking for?
Thank you for your reply. I previously used WordPress a lot and I am familiar to add a logo and the title at the same time. There is logo support in Just the Docs, but that will not show the title text if the logo option is chosen.
So basically, I reckon many will have the need to have a logo on the left side of the title text. Can we put that into a configuration option?
Oh, gotcha - coming back to this now. Hm, what are you envisioning for a configuration option? I'm wary of just adding a path since in these cases, CSS + alt text is usually necessary. Do you think the _includes approach doesn't satisfy a need, or that we should document it better? If documentation is the issue, I think I'd improve that over adding a configuration option.
Here is my proposal in _config.yml:
title: Just the Docs
description: A Jekyll theme for documentation
baseurl: "/just-the-docs" # the subpath of your site, e.g. /blog
url: "https://just-the-docs.github.io" # the base hostname & protocol for your site, e.g. http://example.com
logo: "/assets/images/just-the-docs.png"
# newly added ↓
title_only_logo: false # 'false' to show logo on the left of the title text, 'true' to show logo only (the behaviour of current version)
There may be some other expressions for title_only_logo. With this option, user can choose how the title logo is displayed.
It's good, also i will use for project of us.
@Teddy-van-Jerry thanks for your proposal for the feature to show both a logo and the title text.
To avoid breaking existing sites when adding a new feature, we generally use true as the value for making the feature active: the 'falsy' values nil and false should give the default behaviour of not activating the feature.
So for this feature, I'd suggest a setting such as logo_with_title: true to show the logo on the left of the site title; you might also consider supporting title_with_logo to show the output on the right.
The config for the theme docs can still make the feature active, thereby demonstrating its use. Sites that use the theme (as a gem or remotely) automatically get a copy of all the theme files in _includes, but they do not get the variable settings used in the theme _config.yml.
So to get the correct behaviour, you would probably need to use a Liquid conditional in _includes/title.html to test the values of both site.logo and site.logo_with_title.
@pdmosses Thank you for your nice guidance! I will try to implement this feature recently with a PR.