hugo-casper-two icon indicating copy to clipboard operation
hugo-casper-two copied to clipboard

Add instagram link along with the other social header links.

Open somada141 opened this issue 5 years ago • 6 comments

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!

somada141 avatar Mar 28 '19 22:03 somada141

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...

dixonge avatar May 18 '19 19:05 dixonge

That's awesome thanks a lot @dixonge !

somada141 avatar May 19 '19 01:05 somada141

@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?

somada141 avatar May 19 '19 01:05 somada141

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.

dixonge avatar May 19 '19 12:05 dixonge

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.

somada141 avatar May 19 '19 23:05 somada141

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.

ansin218 avatar Oct 01 '19 18:10 ansin218