hugo-casper-two
hugo-casper-two copied to clipboard
Add instagram link along with the other social header links.
Hi @eueung @dudil . Love the theme and decided to use it for my travel blog. However, I'd like to have an instagram link alongside the existing social links (twitter, FB, medium, etc) and I think it'd be a useful addition for others too.
I'm referring to the different header partials (eg https://github.com/eueung/hugo-casper-two/blob/master/layouts/partials/header.html#L22). Would that be possible?
Cheers!
Since @eueung is absent, I suggest you simply copy header.html to your root hugo install under layouts/partials/ - then edit it to include an appropriate Instagram parameter. It will need a matching change inside of your main config.toml.
so in config.toml include something like igName = ""
and in header.html copy one of the existing sections inside 'social links' and make it look like {{ if .Site.Params.igName }}<a class="social-link social-link-ig" href="https://www.instagram.com/{{ .Site.Params.igName }}" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M19 6h5V0h-5c-3.86 0-7 3.14-7 7v3H8v6h4v16h6V16h5l1-6h-6V7c0-.542.458-1 1-1z"/></svg></a>{{end}}
You'll need to customize the CSS too, if you need something different for the 'social-link-ig' class...
That's awesome thanks a lot @dixonge !
@dixonge actually won't that require overriding the *-sori-*
header files too eg https://github.com/eueung/hugo-casper-two/blob/master/layouts/partials/header-sori.html#L25 or https://github.com/eueung/hugo-casper-two/blob/master/layouts/partials/header-sori-tag.html#L21 ?
Wil overriding header.html alone suffice?
Yeah, actually - it looks like the .Site.Params
code shows up in six different partial files - even if you don't use all of those you might as well change it everywhere, just in case. I use the awesome search/replace function of VS Code for this kind of thing.
Hm since this is quite a large amount of overriding it might make sense to add it to the theme directly instead of overriding half of it. I've no issue doing it but it kinda defeats the purpose of the theme. Do you have write access to the repo @dixonge ? I could submit a PR instead but it seems there's a fair bit of PRs open currently so the repo seems rather inactive.
Jumping in a bit late here. However, the fix for this was simple.
I know this repository is dead and not maintained but in case if anyone is still looking on how to achieve this, my Pull Request is here: https://github.com/eueung/hugo-casper-two/pull/32
Let me know if you folks need further help with other social media handles.