Closed onedrawingperday closed 4 years ago
Hi @onedrawingperday thanks very much for the heads up. I wonder why it is resulting in an error on your side. Here is the page containing the tweet deployed with Netlify: https://personal-web-example.netlify.com/post/shortcodes/#add-a-single-tweet The tweet is showing - I deliberately chose an account and tweet that wouldn't be removed
@bjacquemet
Right. So this ERROR is due to recent Hugo updates.
The external demo is generated with Hugo 0.54.0
but the Hugo website generates always with the latest Hugo currently Hugo 0.62.2
.
Your theme's demo has been broken since last October.
Hugo 0.59.0 introduced support for typed bool, int and float values in shortcode params. Also see: https://github.com/gohugoio/hugo/pull/6376
Upon closer inspection the request generated by the tweet shortcode that is used in your theme points to a non-existent URL:
https://api.twitter.com/1/statuses/oembed.json?hide_thread=1&id=%!s(int=1120412132036706305)&dnt=true"
This part in particular:
- %!s(int=1120412132036706305) -
The tweet ID is outputted as an int due to the way that the tweet-single parameter is entered ie.{{< tweet-single 1120412132036706305 >}}
To fix the ERROR you will need to either change the shortcode input so that the tweet ID is a string by wrapping it in quotes like so: {{< tweet-single "1120412132036706305" >}}
OR
I think it is preferable to do this directly within the shortcode by changing line 6 of tweet-single.html
to something like the following:
{{- $tweetID := print (index .Params 0) -}}
{{- $url := printf "https://api.twitter.com/1/statuses/oembed.json?hide_thread=1&id=%s&dnt=%t" $tweetID $pc.EnableDNT -}}
Once you issue a fix feel free to close this issue.
Thanks a lot. Fixed in the last commit
Hello @bjacquemet
I am one of the maintainers of Hugo Themes.
There is a reference to a non existent tweet in the content files of your theme's exampleSite.
This results in a broken demo on the Hugo Themes website.
I tried to make your theme inherit its content from the hugoBasicExample repo, so that the demo generates.
However this resulted in an empty homepage since your theme has a custom portfolio section and even though you are using Hugo's internal
mainSections
you have hardcoded the section whose content is displayed on the index page.To fix the demo you need to remove the reference to the non-existent tweet.
Also note that as stated in the Hugo Themes README: