Merge pull request #407 from scosti/master

logo - append text according to current url path
This commit is contained in:
Djordje Atlialp 2023-02-04 16:37:00 +01:00 committed by GitHub
commit f928062c5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View file

@ -20,3 +20,13 @@ menuTrigger &&
);
window.addEventListener("resize", isMobileMenu);
const language = document.getElementsByTagName('html')[0].lang;
const logo = document.querySelector(".logo__pathname");
if(logo){
window.onload = () => {
let path = window.location.pathname.substring(1);
path = path.replace(language+'/','')
logo.textContent += path.substring(0,path.indexOf('/'));
};
}

View file

@ -138,6 +138,8 @@ disableHugoGeneratorInject = false
# logoCursorColor = "#67a2c9"
# Set to a valid CSS time value to change the animation duration, "0s" to disable.
# logoCursorAnimate = "2s"
# Append the current url pathname to logoText
# logoCursorPathname = true
# Commento is more than just a comments widget you can embed —
# its a return to the roots of the internet.

View file

@ -4,7 +4,8 @@
<img src="{{ .Site.Params.Logo.path }}" alt="{{ .Site.Params.Logo.alt }}" />
{{ else }}
<span class="logo__mark">{{ with .Site.Params.Logo.logoMark }}{{ . }}{{ else }}>{{ end }}</span>
<span class="logo__text">{{ with .Site.Params.Logo.logoText }}{{ . }}{{ else }}hello{{ end }}</span>
<span class="logo__text {{ with.Site.Params.Logo.logoCursorPathname}}logo__pathname{{ end }}">
{{ with .Site.Params.Logo.logoText }}{{ . }}{{ else }}hello{{ end }}</span>
<span class="logo__cursor" style=
"{{ with.Site.Params.Logo.logoCursorDisabled }}visibility:hidden;{{ end }}
{{ with.Site.Params.Logo.logoCursorColor }}background-color:{{ . }};{{ end }}