ℹ️ Cross-posting in front matter

When Micro.blog copies posts to other services via cross-posting, it records some information such as the external service username and post ID. These parameters are available in the Hugo front matter so they can be accessed from themes.

For example, you may want to automatically link to the Mastodon or Bluesky copy of a post from your blog.

The following parameters are currently supported:

.Params.twitter.id — tweet ID
.Params.twitter.username — your Twitter username

.Params.medium.id
.Params.medium.username

.Params.linkedin.id
.Params.linkedin.name

.Params.mastodon.id
.Params.mastodon.username — just the username part of your full handle
.Params.mastodon.hostname — instance name like “mastodon.social”

.Params.tumblr.id
.Params.tumblr.username
.Params.tumblr.hostname — “you.tumblr.com

.Params.flickr.id
.Params.flickr.username

.Params.bluesky.id
.Params.bluesky.url — the “at://” URL for the post
.Params.bluesky.link — the “https://” URL to bsky.app
.Params.bluesky.handle
.Params.bluesky.hostname
.Params.bluesky.did

.Params.nostr.id
.Params.nostr.pubkey

.Params.pixelfed.id
.Params.pixelfed.username
.Params.pixelfed.hostname

.Params.threads.id — the “media ID” used for API calls
.Params.threads.url — permalink for the post on Threads
.Params.threads.username

An example of using these parameters in your theme might look like this:

{{ if .Params.bluesky }}
  <a class="u-syndication" {{ printf "href=%q" .Params.bluesky.link | safeHTMLAttr }}>
    Also on Bluesky
  </a>
{{ end }}

Note the special printf syntax is needed because of how Hugo handles HTML attributes. It’s not needed outside of HTML tags.

5 Likes