Lightweight GoToSocial sitemap generator
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| BUILDING.md | ||
| go.mod | ||
| LICENSE | ||
| main.go | ||
| main_test.go | ||
| README.md | ||
GoToSocial sitemap.xml generator
GoToSocial sitemap generator written in Go. 100 lines of code. Deploy a single reproducible 6.8 MB binary.
Setup
RSS won't work, you need the API, which requires authorization.
- Create an OAuth app on your instance:
https://<your instance>/settings/user/applications/new- In Application name put "Sitemap generator"
- In Redirect URIs put
https://<your instance>/settings/user/applications/callback - In Scopes put
read
- Click Create
- Click on the created application in applications list
- Scroll to Request An API Access Token
- Ensure
readis in Token scopes - Click Request access token
- Authenticate with your GoToSocial account
- Authorize application by clicking Allow
- Click I understand, show me the token!
- Copy it. Pass this token in the
TOKENenvironment variable (see below)
Install
- Download go2social-sitemap to
/usr/local/bin/go2social-sitemapor build it yourself - Create a systemd unit file at
/etc/systemd/system/go2social-sitemap.service:
Put your instance's URL to GOTOSOCIAL_URL, optionally edit HOST (defaults to 127.0.0.1) and PORT (defaults to 3000).
[Service]
ExecStart=/usr/local/bin/go2social-sitemap
Environment=GOTOSOCIAL_URL=https://m.hloth.dev
EnvironmentFile=/etc/go2social-sitemap/.env
#Environment=HOST=127.0.0.1
#Environment=PORT=3000
DynamicUser=yes
Restart=on-failure
[Install]
WantedBy=multi-user.target
- Create
/etc/go2social-sitemap/.env(EnvironmentFile):
# Paste the token from Setup step 10 in quotes
TOKEN=""
Make sure it's protected:
chmod 600 /etc/go2social-sitemap/.env
- Enable the sitemap generator:
systemctl enable --now go2social-sitemap
- Configure your reverse proxy to forward
https://<your instance>/sitemap.xmlrequests tohttp://127.0.0.1:3000(HOST + PORT). E.g. Caddy with GoToSocial on:8000and the sitemap generator on:3000:
m.hloth.dev {
reverse_proxy /sitemap.xml :3000
reverse_proxy :8000
}
Sitemaps are rebuilt every hour upon new request.
Not included in the sitemap: local-only posts, boosts, replies to other accounts, posts of accounts without "Mark account's posts as full-text indexable" checked in profile settings (off by default).