ref: 3ebb0322cc1e1a028d4b60c49fa1e7ca1a357d93 sourcehut.org/content/blog/2021-02-18-Sourcehut-pages.md -rw-r--r-- 2.1 KiB
3ebb0322Drew DeVault Mention gemini support in pages announcement 2 months ago

#title: Sourcehut pages date: 2021-02-18 author: Drew DeVault

I'm happy to announce that a long-awaited feature is available today: sourcehut pages. SourceHut users can use this service to host static websites for any of their own domains, and every user is also being given "username.srht.site".

Update: gemini support is now available as well!

You can use any static site generator: Jekyll, Hugo, Doxygen, or your own cool new thing. You can publish from git.sr.ht or hg.sr.ht, or you can set up any publishing workflow you prefer — you just need to upload a tarball. Every domain has TLS automatically configured for you. You get your personal subdomain on srht.site, unlimited bring-your-own-domains, and up to 1G of storage per site.

Check out srht.site for the full details, but here are some shell commands you can run right now to be live in 3 minutes.

First, generate a personal access key and add it to your environment, something like this:


Then write a simple "index.html" file:

<!doctype html>
<html lang="en">
<meta charset="utf-8" />
<title>My sourcehut page</title>
<h1>My sourcehut page</h1>
<p>Welcome to my cool sourcehut page!

Put it in a tarball:

tar -cvz index.html > site.tar.gz

And publish it, being sure to replace "username" with your sr.ht username:

curl --oauth2-bearer "$bearer_token" \
    -Fcontent=@site.tar.gz \

Hey presto, your new website is live! Check out the rest of the documentation for tips on automating this process, setting up a static site generator like Hugo, and how to use your own domain name.

All sr.ht pages sites have some limitations to make them good internet citizens:

  • HTTPS is required
  • All third party resources, including Google Analytics, are blocked
  • CloudFlare's reverse proxy is blocked

So everyone who visits a sr.ht page can be confident that everything is above board. Enjoy!