Social media networks
Ananke can show follow links to your social profiles in the header and the footer, and share links on single pages. Both are off until you select networks. This page shows how to set them up. The social network reference lists the built-in networks and the keys of a network definition.
The examples use config/_default/params.toml. In a single hugo.toml, put each table under [params], for example [params.ananke.social.follow].
Add follow links #
Select the networks and their order:
toml# config/_default/params.toml [ananke.social.follow] networks = ["github", "bluesky", "mastodon"]Set your profile for each network. For most networks,
usernameis enough; Ananke inserts it into the network’s profile address:toml# config/_default/params.toml [ananke.social.github] username = "jdoe" [ananke.social.bluesky] username = "jdoe.bsky.social"Some networks have no fixed profile address: Mastodon, RSS, and Slack. Set the complete address with
profilelink:toml# config/_default/params.toml [ananke.social.mastodon] profilelink = "https://mastodon.social/@jdoe"Run
hugo server. The header and the footer show an icon for each network, in the order ofnetworks.
The built-in networks table shows which networks need profilelink.
Change a follow link #
Use these keys in the network’s table, for example [ananke.social.github]:
profilelink: a complete address that replaces the address made fromusername.label: the network name in the link title and accessible name, for examplelabel = "GitHub (work)".rel: values for the link’srelattribute. Ananke always addsnoopener. For example,rel = "me"lets a service such as Mastodon verify that the profile is yours.
# config/_default/params.toml
[ananke.social.mastodon]
profilelink = "https://mastodon.social/@jdoe"
rel = "me"Add share links #
Select the share networks and their order:
# config/_default/params.toml
[ananke.social.share]
networks = ["email", "facebook", "bluesky", "linkedin"]Single pages then show a share link for each network. Use only networks that define a share address; the built-in networks table marks them.
Share links are plain links built from the page address, title, and summary. They load no third-party scripts.
Two options change the link content:
icons(defaulttrue): show the network icon in each link. Whenfalse, the link shows its text.sharetext(defaulttrue): give each link the text “Share on” and the network name. With icons, this text is the link title and accessible name.
Do not set both icons and sharetext to false, because the links are then empty.
Disable sharing partially or globally #
To hide the share links on one page, add disable_share to its front matter:
---
title: Private notes
disable_share: true
---[!WARNING] In Ananke v2.23.0, any
disable_sharevalue in front matter hides the share links, alsodisable_share: false. Remove the key to show share links on a page. See ananke#1140.
To remove share links from all pages, leave ananke.social.share.networks unset, or set it to an empty list. The theme ships no share networks by default:
# config/_default/params.toml
[ananke.social.share]
networks = []The option ananke.social.share.disable_share in the site configuration has no effect in Ananke v2.23.0.
Replace or add icons #
Ananke shows the SVG file assets/ananke/socials/<icon>.svg in each link, where <icon> is the network’s icon value. A file with the same path in your site replaces the theme’s file.
In v2.23.0, some built-in networks have no icon file: email, Hacker News, LinkedIn, Slack, Stack Overflow, Twitter, and X. Their links have no visible content. Add your own icon for each network that you use:
- Get an SVG icon for the network, and check that its licence allows your use.
- Save it with the name from the Icon column, for example
assets/ananke/socials/linkedin.svgorassets/ananke/socials/envelope.svg. - Run
hugo serverand check that the link shows the icon.
Ananke sets fill: currentColor on the icons, so use an SVG without its own fill colour.
Add a network #
To link to a network that Ananke does not define, add a network definition and your profile. This example adds Codeberg, for which the theme ships an icon:
# config/_default/params.toml
[ananke.social.networks.codeberg]
slug = "codeberg"
label = "Codeberg"
color = "#2185d0"
profile = "https://codeberg.org/%s"
icon = "codeberg"
[ananke.social.codeberg]
username = "jdoe"
[ananke.social.follow]
networks = ["github", "codeberg"]To use the network for sharing, also set link and particles. To change one key of a built-in network, set only that key, for example [ananke.social.networks.linkedin] with color = "#0a66c2". The network definition reference describes every key.
To link two profiles on the same network, define a second network with its own slug, for example github2, and the same values.
Upgrade from Ananke 2.10 or earlier #
Ananke 2.11.0 replaced the old social settings. See Upgrade social links from Ananke 2.10 or earlier.
Back to contents