appernetic / hugo-nederburg-theme

Nederburg is a fast and secure hugo theme and is a port of the Tracks WP theme
Other
107 stars 89 forks source link

Individual metatag description #10

Closed jalexandre0 closed 6 years ago

jalexandre0 commented 6 years ago

My simplest approach.

{{ with .Site.Params.description }}
<!-- <meta name="description" content="{{ . | default "" }}"> -->
<meta name="description" content="{{if $.IsHome}}{{ $.Site.Params.description }}{{else}}{{ 
$.Page.Description }}{{end}}">
{{ end }}

Do not make a PR because I do not know the best way to do it or test it.

PS: This break the description on catgories, tags and elsewhere except home page and pages with description param. Looking for a fix or a way to write individual description for categories and tags too.

tordanpersson commented 6 years ago

Hi, one simple solution is to override the theme file that has the meta description.

Put it in /layouts/

and have the same folder structure as in the theme.

I just done this for the smorg theme and did it like this (line 14):

https://github.com/tordanpersson/appernetic-hugo-project/blob/d0900bbc98a4ef15954ce6c4267151f5dd149aca/layouts/partials/head.html#L14

jalexandre0 commented 6 years ago

@tordanpersson Way better than my workaround. :)

head.html -> 6e0935e19eb44f2de5719366dec46283d04ddefa exampleSite/content/work2 -> d4fc292a5aaec6c3f2bba1605844075db85b31ff

Should I open a pull request?

appernetic commented 6 years ago

Hi, yes please do that!