gokarna-theme / gokarna-hugo

A minimal opinionated theme for Hugo
https://gokarna-hugo.netlify.app
GNU General Public License v3.0
357 stars 139 forks source link

h1 header text on posts page #189

Closed ghost closed 1 year ago

ghost commented 1 year ago

Is it possible to change the h1 header text on the Posts page? I mean, I find if I change the name of the posts directory that changes the text — though in variable ways, sometimes it just uses the directory name, sometimes it adds an "s", sometimes it adds "es". But if I wanted it to say for instance "John Smith's Fabulous Blog Posts" how would I do that? Short of changing the directory name to "John Smith's Fabulous Blog Posts".

ghost commented 1 year ago

Answering my own question in case it helps others, and asking a followup:

To change the h1 header text, create posts/_index.md with type: post and title: "John Smith's Fabulous Blog Posts".

Content of this file below the header appears to be ignored.

Followup: Is there a way to add text that will appear above the listing of posts?

yashmehrotra commented 1 year ago

Answering my own question in case it helps others, and asking a followup:

To change the h1 header text, create posts/_index.md with type: post and title: "John Smith's Fabulous Blog Posts".

Content of this file below the header appears to be ignored.

Thanks for this

Followup: Is there a way to add text that will appear above the listing of posts?

Do you want to add a text above H1 ? can you send a rough picture/mockup of what you intend ?

ghost commented 1 year ago

Something like this:

Untitled

though text above H1 would be acceptable too.

ghost commented 1 year ago

This does almost what I want: Copy themes/gokarna/layouts/partials/list.html to layouts/partials and add

  {{ .Content }}

where I want it (after the H1 header). Then add content to the posts/_index.md file:

image

Result looks like

image

The one problem is the HTTPS link. It's there and it is functional, but it is not underlined as links are on other pages (though the links in the posts list are not underlined either).

That can be fixed with some custom css, though.

On the other hand if instead of a custom layouts/partials/list.html I create layouts/_default/list.html containing

{{ define "main" }}
    {{ if eq .Type "page" }}
        {{- partial "page.html" . -}}
    {{ else }}
        {{ .Content }}
        {{- partial "list.html" . -}}
    {{ end }}
{{ end }}

the result looks like

image

Now the link is underlined. But the content appears above the H1 header, which is not what I'd prefer, and it's wider than the rest of the page.

ghost commented 1 year ago

The above custom partials/list.html with suitable css tweaking does what I want, I think.