📢 Actions Speak Louder Than Words!

Hugo "GetJSON" now support HTTP Header

Posted: Oct 9, 2021 | Reading time: 1 min
⚠️ Warning: This post is over a year old, the information may be out of date.

TIL that hugo actually support custom HTTP headers to be use together with getJSON function which means you not anymore limited to just use or call API that have token=xxx on URL parameter anymore. Now you can use some header such as Authorization (example: Bearer, OAuth and more).

The implementation is quite simple just create a dictionary data and put the information inside and bind it together with getJSON as second parameter.


Below is an example for my custom Hugo shortcode to get Malaysia forecast from MET API which require to send custom bearer Authorization on HTTP header for each request

Please take note, this feature only available for released hugo version 0.84.0 and above. Thanks for the fish!


Have some thoughts, discussion or feedback on this post?
IndieWeb Interactions

Below you can find the interactions that this page has had using Indieweb. Which means, you can mentioned this URL on any website that support WebMention. Have you written a response to this post? Let me know the URL:

((Do you use a website that do not set up with WebMention capabilities? You can use Comment Parade.)

Mentions, bookmarks, likes and repost