razonyang / hugo-theme-bootstrap

A fast, responsive, multipurpose and feature-rich Hugo theme.
https://hbs.razonyang.com
MIT License
495 stars 169 forks source link

Add meta tag to head #235

Closed VaibhavSys closed 2 years ago

VaibhavSys commented 2 years ago

Hello,

I wanted to add a meta tag to the headers, I need to add it to the home page of my website. How can I do that? I tried removing the .gitignore file and changing it in the public/index.html then pushing it, it didn't work tho.

Please help!

razonyang commented 2 years ago

There are Hooks that provide the ability to add custom code on a page.

In this case, create a hook named layouts/partials/hooks/head-end.html:

{{- if .IsHome -}}
<meta name="foo" content="bar">
{{- end -}}
VaibhavSys commented 2 years ago

I did it and I am getting this error:

Error: add site dependencies: load resources: loading templates: "/home/sparrow/cyborgstation-website/layouts/partials/hooks/head-end.html:3:1": parse failed: template: partials/hooks/head-end.html:3: unexpected {{end}} Total in 29 ms

razonyang commented 2 years ago

Sorry, I modified the code snippet. Please try again

VaibhavSys commented 2 years ago

Sorry, I modified the code snippet. Please try again

Np, it worked! Thanks

VaibhavSys commented 2 years ago

idk about these hooks, do you know where can I put this? <a class="copyrighted-badge" title="Copyrighted.com Registered &amp; Protected" target="_blank" href="https://www.copyrighted.com/website/m8f7sHfLeK1QozT7"><img alt="Copyrighted.com Registered &amp; Protected" border="0" width="125" height="25" srcset="https://static.copyrighted.com/badges/125x25/03_1_2x.png 2x" src="https://static.copyrighted.com/badges/125x25/03_1.png" /></a><script src="https://static.copyrighted.com/badges/helper.js"></script>

I was adding my site to copyrighted.com also if I want to upload custom HTML files, how could I do that?

VaibhavSys commented 2 years ago

I want <a class="copyrighted-badge" title="Copyrighted.com Registered &amp; Protected" target="_blank" href="https://www.copyrighted.com/website/m8f7sHfLeK1QozT7"><img alt="Copyrighted.com Registered &amp; Protected" border="0" width="125" height="25" srcset="https://static.copyrighted.com/badges/125x25/03_1_2x.png 2x" src="https://static.copyrighted.com/badges/125x25/03_1.png" /></a><script src="https://static.copyrighted.com/badges/helper.js"></script> added to every page automaticaly which will be created in the future or exists already, how can I do it?

razonyang commented 2 years ago

All hooks are documented in https://github.com/razonyang/hugo-theme-bootstrap#hooks. The footer-begin, footer-end, main-begin, main-end and body-end may meet your requirement, it is up to you to decide where to place the code.

VaibhavSys commented 2 years ago

All hooks are documented in https://github.com/razonyang/hugo-theme-bootstrap#hooks. The footer-begin, footer-end, main-begin, main-end and body-end may meet your requirement, it is up to you to decide where to place the code.

Ohk, I didn't knew that, thanks!