https://github.com/turekbot/suri-playground
A place to try out Suri
https://github.com/turekbot/suri-playground
Last synced: 3 months ago
JSON representation
A place to try out Suri
- Host: GitHub
- URL: https://github.com/turekbot/suri-playground
- Owner: TurekBot
- License: mit
- Created: 2025-03-02T21:05:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-02T21:29:11.000Z (over 1 year ago)
- Last Synced: 2025-03-02T22:19:48.966Z (over 1 year ago)
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Your own short links as an easily deployed static site on GitHub Pages
You're viewing a template repository tailored for deploying Suri to
[GitHub Pages](https://pages.github.com/) with
[GitHub Actions](https://docs.github.com/en/actions). Head over to
[the main repository](https://github.com/surishortlink/suri) to learn more about
Suri, including additional deployment options.
## Setup: Step By Step
1. Hit the "Use this template" button above and then "Create a new repository".
Fill in the required details to create a new repository based on this one.
2. Go to the "Settings" of your new repository and head to the "Pages" section.
Under "Build and deployment", change the "Source" to "GitHub Actions".
3. Go to the "Actions" of your new repository. There should be a workflow run
that likely failed because the previous step wasn't yet completed. Go ahead
and view the workflow run and hit the "Re-run jobs" button.
### Auto-Deploy
Any commits to the `main` branch of your new repository will trigger a new build
and deploy. You can change this by editing
[`.github/workflows/deploy.yml`](.github/workflows/deploy.yml), which is the
GitHub Actions workflow for building the site and deploying to GitHub Pages.
### Custom Domain
To use a custom domain, follow GitHub's guide:
[Managing a custom domain for your GitHub Pages site](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site).
## How It Works
### Manage Links
At the heart of Suri is the [`links.json`](src/links.json) file, located in the
`src` directory, where you manage your links. All of the template repositories
include this file seeded with a few examples:
```json
{
"/": "https://www.youtube.com/watch?v=CsHiG-43Fzg",
"1": "https://fee.org/articles/the-use-of-knowledge-in-society/",
"gh": "https://github.com/surishortlink/suri"
}
```
It couldn't be simpler: the key is the "short link" path that gets redirected,
and the value is the target URL. Keys can be as short or as long as you want,
using whatever mixture of characters you want. `/` is a special entry for
redirecting the root path.
### Build Static Site
Suri ships with a `suri` executable file that generates the static site from the
`links.json` file. The static site is output to a directory named `build`.
All of the template repositories are configured with a `build` script that
invokes this executable, making the command you run simple:
```bash
npm run build
```
When you make a change to the `links.json` file, simply re-run this command to
re-generate the static site, which can then be re-deployed. This template
repository is configured to do this automatically.
### Config
Configuration is handled through the [`suri.config.json`](suri.config.json) file
in the root directory. There is only one option at this point:
| Option | Description | Type | Default |
| ------ | ------------------------------------------------------------------ | ------- | ------- |
| `js` | Whether to redirect with JavaScript instead of a `` refresh. | Boolean | `false` |
### Public Directory
Finally, any files in the `public` directory will be copied over to the `build`
directory without modification when the static site is built. This can be useful
for files like `favicon.ico` or `robots.txt` (that said, Suri provides sensible
defaults for both).