AmazingRise / hugo-theme-diary

Moments piled up. A Hugo theme ported from SumiMakito/hexo-theme-Journal.
MIT License
568 stars 194 forks source link

Question about adding an author for posts #143

Closed babadoctor closed 1 year ago

babadoctor commented 1 year ago

How can I add an author label to posts, which can be added by editing the front matter of a webpage? See attached pictures for what I had in mind.

author3 author 2 author1

Thank you

AmazingRise commented 1 year ago

Hi babadoctor,

You can add {{ .Params.author }} to:

https://github.com/AmazingRise/hugo-theme-diary/blob/bad0d28ed269fe2d7ea3c6e252dbaedc8fd4c74e/layouts/_default/single.html#L75

and

https://github.com/AmazingRise/hugo-theme-diary/blob/bad0d28ed269fe2d7ea3c6e252dbaedc8fd4c74e/layouts/_default/single.html#L28

Later I'd consider to introduce this feature. Thanks for your advice.

babadoctor commented 1 year ago

Hi Rise,

Adding {{ .Params.author }} to line 75 worked in adding the author to the bottom of each page, but for some reason adding it to line 28 did not add it to the post meta.

This is what my code looks like image

AmazingRise commented 1 year ago

It works for me. image image

babadoctor commented 1 year ago

Adding it to post-item-meta.html seems to fix it

Thanks rise! image

If this is wrong somehow let me know