hugo new site directory-name --format=extension
When you create a Hugo project with this command:
hugo new site directory-name --format=extension
For example:
hugo new site directory-name --format=yaml
This directory structure is created:
. └── directory-name/ ├── archetypes/ ├── assets/ ├── content/ ├── data/ ├── layouts/ ├── public/ ├── static/ ├── themes/ └── config.extension
💡 |
|
data
directoryIn
your
Hugo
layout files — including in your shortcodes — you can
access
the contents of
a
non-config
JSON,
TOML,
YAML
or
XML
file
by putting
the file in your
project’s data
directory.
For example:
. └── directory-name/ ├── archetypes/ ├── assets/ ├── content/ ├── data/ │ └── nitter.yaml ⟵👀 ├── layouts/ ├── public/ ├── static/ ├── themes/ └── config.yaml
To learn about this
nitter.yaml
file, see
the next section.
To learn about the
data
directory, see…
In July 2022, I started including Nitter links on some Infinite Ink portals. Nitter is a Twitter front-end focused on privacy, which you can learn about at…
Because Nitter instances are often overloaded, I use Hugo’s shuffle function to select a random Nitter instance for each timeline that I link to. Below are the steps I used to set this up.
First, I created the following YAML[2] file that lists Nitter instances.
## A line beginning with # is a comment and is ignored instances: - nitter.net - nitter.42l.fr - nitter.pussthecat.org - nitter.kavin.rocks - nitter.unixfox.eu - nitter.namazso.eu - nitter.hu - nitter.moomoo.me - nitter.it - twitter.censors.us - nitter.grimneko.de # - nitter.ca # discontinued 2022-11-26 - nitter.fly.dev - notabird.site - nitter.weiler.rocks - nitter.sethforprivacy.com # - nttr.stream - nitter.cutelab.space - nitter.nl - nitter.mint.lgbt # - nitter.bus-hit.me 2022-12-04 "504 Gateway Time-Out" - nitter.esmailelbob.xyz - tw.artemislena.eu # - de.nttr.stream 2022-08-21 offline - nitter.winscloud.net - nitter.tiekoetter.com - nitter.spaceint.fr - twtr.bch.bar # - nitter.privacy.com.de 2022-10-15 "Instance has been rate limited" # - nitter.mastodon.pro # - nitter.notraxx.ch - nitter.poast.org - nitter.bird.froth.zone - nitter.dcs0.hu - twitter.dr460nf1r3.org - nitter.garudalinux.org - twitter.beparanoid.de - n.ramle.be - nitter.cz - nitter.privacydev.net - tweet.lambda.dance # - nitter.ebnar.xyz - nitter.kylrth.com - nitter.foss.wtf - nitter.priv.pw - nt.vern.cc # - nitter.wef.lol - nitter.tokhmi.xyz - nitter.catalyst.sx - unofficialbird.com - nitter.projectsegfau.lt - singapore.unofficialbird.com - twt.funami.tech - nitter.fprivacy.com - canada.unofficialbird.com - india.unofficialbird.com - nederland.unofficialbird.com - uk.unofficialbird.com - n.l5.ca - nitter.slipfox.xyz - nitter.soopy.moe - nitter.qwik.space - read.whatever.social - nitter.rawbit.ninja - nt.vern.cc # - ntr.odyssey346.dev # 2022-11-12 08:49:23 not working atm - nitter.ir # - nitter.privacytools.io 2022-09-30 not working - nitter.sneed.network - n.sneed.network - nitter.manasiwibi.com - nitter.smnz.de - nitter.twei.space - nitter.inpt.fr # - nitter.d420.de 2022-10-16 said "Enable JavaScript ... to continue" wtf? - nitter.caioalonso.com - nitter.at - nitter.drivet.xyz - nitter.pw - nitter.nicfab.eu # - bird.habedieeh.re 2022-12-30 redirected to Instances - nitter.hostux.net - nitter.adminforge.de - nitter.platypush.tech - nitter.mask.sh - nitter.pufe.org - nitter.us.projectsegfau.lt - nitter.marcopisco.com - nitter.arcticfoxes.net - t.com.sb - nitter.selfhostable.net # - bluebird.codeine.world - nitter.kling.gg - twt.funami.tech - nitter.ktachibana.party - nitter.riverside.rocks - bird.wilbvr.me - nitter.girlboss.ceo - nitter.lunar.icu - twitter.moe.ngo - nitter.freedit.eu - ntr.frail.duckdns.org - nitter.us.projectsegfau.lt
Next, I created something like the following Hugo shortcode.
To view @nm’s <em>gohugo</em> Twitter list on a random <a href="https://github.com/zedeus/nitter/wiki/Instances">Nitter instance</a>, go to {{ range site.Data.nitter.instances | shuffle | first 1 -}} <a href="https://{{ . }}/nm/lists/gohugo"> {{- . -}}/nm/lists/gohugo</a>. {{ end }}
Note that
the
bolded
line
uses
Hugo’s
contextless
global
site
function[3]
to
access
site.Data.nitter.instances
.
To call this shortcode in a content file, for example in the source of this article, I use the following syntax.
{{< nitter-instance-of-nm-gohugo-list >}}
Here is how this shortcode is rendered on this build of this page:
To view @nm's gohugo Twitter list on a random Nitter instance, go to nitter.nicfab.eu/nm/lists/gohugo.
Note that each time
that
Hugo builds this
Infinite Ink
website,
the Nitter instance
(nitter.nicfab.eu in this case)
For more about Hugo, see Infinite Ink’s…
Variable and Parameter Names in Hugo (featuring camelCase🐫 and snake_case🐍)
🔗 Linkified Section Headings in Hugo-Generated Web Pages (featuring Markdown and AsciiDoc examples)
Hugo’s Markup Languages: AsciiDoc, HTML, Markdown,
A Way to Compare Hugo’s Markup Languages (featuring inline footnotes)
Hugo’s .RenderString
Method (featuring AsciiDoc admonitions in Markdown and Go HTML)
Configuring Security in Hugo (featuring settings needed to use Asciidoctor and Pandoc)
Hugo Tutorial: Bundleless, Themeless, & Gitless Introduction to the Hugo SSG
site
function is contextless by noticing that it does not have a leading dot (.
). To learn about this global function, see the Hugo v0.53 release notes, especially the relevant GitHub commit and GitHub issues.@nm@mathstodon.xyz
or
#InfiniteInk
in it.