Automatic Unsplash Copyright Shortcode for Hugo

I use a lot of photos from unsplash as headers. This shortcode works in two ways to make that easier:

  1. Standard use
    {{< copyright name=“Malte Wingen” href=“https://unsplash.com/@maltewingen?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText” >}}

  2. Automatic parsing of filename
    {{< copyright >}}

First one allows you to customize the name and url, second one will infer that information from the default unsplash filename.

This assumes the following frontmatter data is present:

resources: 
	- src: images/markus-winkler--TRcaFMV5vk-unsplash.jpg
	  name: "header"

Hope it helps :slight_smile:

4 Likes