GitXplorerGitXplorer
n

flickr-hugo-embed

public
23 stars
5 forks
0 issues

Commits

List of commits on branch master.
Unverified
6d7c6e7ac755ca870c9c2463f5693ac411a4b1e7

Replace newlines with spaces in caption to not trip the hugo parser

nnikhilm committed 9 years ago
Unverified
96296fddc89ee0d95e99b0ce1b89f7395d2aaa07

remove scripts section from package.json

nnikhilm committed 9 years ago
Unverified
9e58b3e28231f2cd1f79671139fb3c2356217387

added license

nnikhilm committed 9 years ago
Unverified
ea587b60ccf057e155bd71dac2392648e6b00211

Updated README

nnikhilm committed 9 years ago
Unverified
89a7464cc392db6f90476496cb1b9c66d8f22b59

Updated README

nnikhilm committed 9 years ago
Unverified
ee874c9fd1c76ca74b24db4ae7c78661b5be1c47

Initial commit. Works, but no error handling

nnikhilm committed 9 years ago

README

The README file for this repository.

flickr-hugo-embed

A node.js tool that generates shortcodes for all the photos in a Flickr Album to allow easily embedding Flickr images into a static site created using Hugo

An example generated code:

{{% flickr "Title"
           "Caption"
           "link to photo page"
           "link to source image" %}}

The flickr shortcode is provided in this repository and can be copied to layouts/shortcodes/flickr.html in your site's directory.

Only works on public images since it does not perform user authentication.

Setup

Clone this repository, then:

npm install .

You will have to get a API key from Flickr.

Create a file config.ini in the current directory:

api_key = "put the new API key here"
user_id = "put your user ID here"
size = "Medium 640"

The user id can be obtained by visiting this page while you are logged in. It will show the ID in "Useful Values"

Possible values for the size attribute are found here. If a photo does not have the size you select, it will be ignored

The default shortcode always sets the image width and height as 640x480 corresponding to the "Medium 640" size.

Run

node bin.js

prints out all albums (photosets) so you can find the ID of the album (photoset).

node bin.js photosetid

generates flickr shortcode for each photo in the photoset.

You can put each code wherever you want to include the image in your site.

The first run can take a little time as the Flickr API is introspected and cached.

Copy over flickr.html to layouts/shortcodes/ in your Hugo installation and you are ready to go!

The default shortcode is based on the code generated by the figure shortcode in the theme twentyfourteen. You can edit it as you like, but remember to access the write positional parameters.