kaushalmodi / hugo-atom-feed

Hugo theme component for ATOM feed custom Output Format
GNU General Public License v3.0
39 stars 13 forks source link

Add logo and icon if it was specified by the user #4

Closed jpawlowski closed 4 years ago

kaushalmodi commented 4 years ago

Instead of have feedicon and feedlogo scattered in the site Params, it would be nice to have a feed map. Can you please refactor this for that?

Then I can pull in feedsections, limit, etc into that feed map.

jpawlowski commented 4 years ago

@kaushalmodi

hope I did it the right way.

kaushalmodi commented 4 years ago

This (saw your refactoring) will break the site build (I believe) if site.Params.feed is absent altogether.

You'll need to wrap that code in with site.Param "feed"

kaushalmodi commented 4 years ago

As an example, see this: https://gitlab.com/kaushalmodi/hugo-theme-refined/blob/master/layouts/partials/social.html

Which parses this in config.toml:

  [[Params.social]]
    name = "Github"
    link = "https://github.com/kaushalmodi/"
    relme = true
  [[Params.social]]
    name = "Gitlab"
    link = "https://gitlab.com/users/kaushalmodi/projects"
kaushalmodi commented 4 years ago

My own snippet reminded me that you do not need to use site.Param .. just .Param would also work. Hugo, in that case, first checks for that param in the Page scope, and if nothing is found, it checks in .Site.

jpawlowski commented 4 years ago

Thank you so much, still learning Go and Hugo at the same time ...

kaushalmodi commented 4 years ago

I have merged this manually, and then refactored it a bit: https://github.com/kaushalmodi/hugo-atom-feed/commit/66355e991c075d1f39a1bb7bc9b2b166b4e52db2

Look into resources feature of Hugo; it's awesome!

Example: https://gitlab.com/kaushalmodi/hugo-theme-refined/blob/e0a6e87f245211317f2fcd13a44608fc3ebf9224/layouts/partials/head.html#L164-172