Skip to content

agriyakhetarpal/hugo-twitter-timeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Tip

The Twitter timeline may fail to display in certain scenarios, however, this error comes not from Twitter and not from Hugo or this shortcode. A common cause of error is if Twitter fails to retrieve sufficient login credentials in the browser client when serving requests on a webpage. As of 25th December 2023, this has not been fixed on Twitter's end.

hugo-twitter-timeline

A simple Hugo shortcode for embedding a Twitter timeline, based on the Twitter widgets code, which can be accessed via https://publish.twitter.com/ and https://platform.twitter.com/widgets.js

Parameters

The supported parameters are

  • username: The username of the Twitter account to embed the timeline for (required)
  • language: The ISO 639-1 language code for the language in which to render the timeline (see Supported languages and browsers – Twitter for Developers for more information), set automatically by Twitter if not specified
  • width: The width of the timeline in pixels
  • height: The height of the timeline in pixels
  • donottrack: Whether to enable the Do Not Track feature, either true or false – defaults to true to preserve your privacy
  • theme: The theme to use for the timeline, either light or dark – defaults to light

Usage

To use the shortcode, simply add the following to your Hugo content file(s) and/or customise as needed:

{{< twitter-timeline username=twitter language=en width=500 height=800 donnottrack=true theme=dark >}}

assuming that the shortcode is saved as twitter-timeline.html in your Hugo theme's layouts/shortcodes directory.

License

This project is licensed under the MIT License.

Footnotes

Please feel free to use it across your projects and star this repository. If you have any questions or suggestions, please feel free to open an issue or a pull request.

Releases

No releases published

Packages

No packages published

Languages