Hugo SEO / Social Partials

Here’s my proposal for .Params. @spf13 - I really like the idea of having methods that can be easily used to grab the first entry as a variable that can be used to access data. In fact, since we’re defining .Site.Authors, we could make a function called .AuthorDetails or something that would perform the map index to .Site.Authors and return a single author object with all the fields defined in .Site.

A similar idea would be great for images and videos, where you could immediately get access to the first one, rather than having to use the more cumbersome {{ index ... }} syntax.

I’m interested to see what your thoughts are in this regards. I was thinking somewhat the reverse, that Hugo could take embedded images and auto-add them to the end of the images array. My thought was that once we set up the standard metadata location, each individual theme could auto embed where it makes sense. The use cases that come to mind are:

  1. Featured Images - used as a thumbnail in summary views, etc. They would use the first image in the array as the featured image.
  2. Galleries - A theme could easily embed a slideshow, gallery or other grouping of media.
  3. Image preprocessing - Having arrays of data makes some other things almost trivial, like image preprocessing. The user / theme could define some standard sizes that would be autogenerated on a Hugo build. The theme could then refer to those specific sizes with some standard methods like .Params.Images[1].Large.
    +++
    // This needs to map to one of the authors setup in the .Site.Params
    authors      = [ "jconnor", "sconnor" ]

    // An array of urls to any images referenced in the post. The first image in the array will be the default shareable image.
    images       = [
                "http://www.mirf.ru/Articles/29/5857/T2.jpg",
                "http://img2.wikia.nocookie.net/__cb20090810001437/terminator/images/d/dc/John_conor_05.jpg",
              ]

    // An array of urls to any videos referenced in the post. The first video in the array will be the default shareable video.
    videos       = [
                "https://www.youtube.com/watch?v=WeON54DhMW4",
                "https://www.youtube.com/watch?v=dy5oTJajGOk",
              ]

    // The first 10 will be inserted into the Google "news_keyword" meta tag
    news_keywords = [ "skynet", "terminator", "john connor" ]
2 Likes