I have been playing with pushing content into my Hugo site using IFTTT (If this then that)
This is a proof of concept work in progress. In this example I create a links page based on websites I have put into Pocket. In theory you could use any IFTTT recipe to feed the information in.
The setup is an IFTTT recipe that looks for new items in Pocket and then appends the details into a text file in Dropbox.
On my linux hugo server I have Dropbox syncing locally to a folder - the text file arrives and is then included onto a Hugo content page.
First setup IFTTT with a new recipe - pick Pocket trigger channel:
Choose your trigger - I picked any new favourite item:
Choose Dropbox as your action channel:
Use action ‘Append to text file’
Setup the text file contents - you can use markdown here:
# {{AddedAt}} <br>
## {{Title}}<br><br>
{{Excerpt}}<br><br>
Tags: {{Tags}}<br><br>
via Pocket {{Url}}<br><br>
- - - - -<br>
Save the recipe and put a few things in Pocket.
If all went well you will end up with a text file in your Dropbox folder.
Mine is at:
/home/jail/Dropbox/IFTTT/Pocket/pocket-links.txt
Now we create a content file in Hugo - in order to inject the contents of the text file you need to use mmark rather than md. This content file is then rendered by Hugo:
/home/jail/blog/content/links.mmark
+++
categories = []
date = "2016-05-02T06:06:20Z"
description = ""
title = "Links"
+++
# Pocket Links Directory
{{/home/jail/Dropbox/IFTTT/Pocket/pocket-links.txt}}
Now when the site is generated it will render the text onto your site:
The only downside with this approach is that Hugo watch will not live update when the links text file is updated in Dropbox. Placing it in static also doesn’t help as we need to force links.mmark to be processed. I am working around that by using cron to run Hugo. If there is a better way to have Hugo watch and republish the whole site when one static file changes I would be interested to know how!
Hope you find this useful / interesting