~uglyduck/uglyduck.srht.site

44110fe7568467bf142ffce45b41b220e6595f83 — Bradley Taunt 2 years ago 7e6d29a
Update Jekyll hosting on sourcehut post instructions
1 files changed, 14 insertions(+), 10 deletions(-)

M _posts/2021-12-06-jekyll-sourcehut.md
M _posts/2021-12-06-jekyll-sourcehut.md => _posts/2021-12-06-jekyll-sourcehut.md +14 -10
@@ 30,17 30,15 @@ Keeping that in mind, let's get into setting up our static site!

1. Create a new account on [sourcehut](https://sourcehut.org) (or log in to an existing one)
2. Setup your billing to contribute monthly (tier amount is up to you)
3. Create a new repo under the **git** section
  - **Important**: Name this repo : `yourusername.srht.site`
4. Be sure to create a [personal access token](https://meta.sr.ht/oauth2/personal-token) (and keep this somewhere secure / safe)
5. Connect this repo locally (as you would via any other git host)
6. In this new local directory, place all your Jekyll files as you would with any other static hosting provider
3. Create a new repo under the **git** section[^1]
4. Connect this repo locally (as you would via any other git host)
5. In this new local directory, place all your Jekyll files as you would with any other static hosting provider

## The sourcehut build file

In order to have your Jekyll site build and push the correct files live, you will need to use sourcehut's build system. This will run every time you push out a new change to your repo (new blog post, page content changes, styling updates).

To make things easier, you can copy the build file below (remember to use your *own* information for usernames, etc):
To make things easier, you can copy the build file below (remember to use your *own* information for usernames, git repo naming etc):

```
image: debian/stable


@@ 51,16 49,16 @@ packages:
environment:
  site: yourusername.srht.site
sources:
  - https://git.sr.ht/~yourusername/yourusername.srht.site
  - https://git.sr.ht/~yourusername/your-repo-name
tasks:
- install-bundler: |
    sudo gem install bundler
- build: |
    cd yourusername.srht.site
    cd your-repo-name
    bundle install
    bundle exec jekyll build
- package: |
    cd yourusername.srht.site/_site
    cd your-repo-name/_site
    tar -cvz . > ../../site.tar.gz
- upload: |
    acurl -f https://pages.sr.ht/publish/$site -Fcontent=@site.tar.gz


@@ 93,4 91,10 @@ And that's it - custom domain set! If you run into any issues check out the [off

Hopefully this helps to streamline the process for others to host their static sites through sourcehut. Having open and healthy competition among host providers and `git` workflows is essential to avoiding vendor lock-in. 

Even low-effort support for open-source products (like where you host your static site or FOSS projects) can go a long way. Just some food for thought.
\ No newline at end of file
Even low-effort support for open-source products (like where you host your static site or FOSS projects) can go a long way. Just some food for thought.

---

## Footnotes

[^1]: Thanks to [McSinyx](https://fosstodon.org/web/@cnx@nixnet.social) for pointing out that the repo used for creating your website can be named anything (instead of defaulting to your sourcehut username)
\ No newline at end of file