Instagram_simple shortcode doesn't work

Hello.

As I understand, the instagram shortcode doesn’t work the way it is depicted
in the documentation, thus other post refer to this issue

I found that this solution works for me:

{{- $pc := .Page.Site.Config.Privacy.Instagram -}}
{{- if not $pc.Disable -}}
{{- if $pc.Simple -}}
{{ template "_internal/shortcodes/instagram_simple.html" . }}
{{- else -}}
{{ $id := .Get 0 }}
{{ $hideCaption := cond (eq (.Get 1) "hidecaption") "1" "0" }}
{{ with getJSON "https://graph.facebook.com/v8.0/instagram_oembed/?url=https://instagram.com/p/" $id "/&hidecaption=" $hideCaption "&access_token=<APPID>|<CLIENTTOKEN>" }}{{ .html | safeHTML }}{{ end }}
{{- end -}}
{{- end -}}

So when i use this in my .md file:

{{< instagram CLH064aBUe7 hidecaption >}}

The image shows all fine

I want to use the instagram_simple shortcode:

{{< instagram_simple CLH064aBUe7 hidecaption >}}

but that gives me this error:

Failed to retrieve remote file: Bad Request

I undestand that piece of shortcode should enable the instagram_simple but I dont quite understand what im doing wrong here.

This is a known issue.

I do not have the time to post the links for you, but if you search the forum and the GitHub issues at the main Hugo repository, there has been discussion about it (not only in the issue you linked to above).

The Instagram oEmbed API has been shut down.
You can only embed content using authentication via the new Facebook/Instagram Graph API.

You need to write a shortcode for the new API and use it in your project.

Also note that there is an open issue about removing all these built-in shortcodes and internal templates from Hugo core.

This topic was automatically closed after 14 hours. New replies are no longer allowed.