Skip to content

GitHub Pages URL shortener

Actions
Use GitHub Pages as your URL shortener
v1.1
Latest
Star (4)

URL shortener action

This action allows you to easily generate HTML pages needed for a simple URL shortener hosted on GitHub Pages. Can be useful for open-source projects to manage short URLs for e.g. documentation allowing contributors to create/edit them.

Inputs

path

Path to the uploaded website root

Default: .

json

Path to a config JSON file.

Default: links.json

template

Optional path to a custom template file for redirection pages.
GitHub Pages does not support returning 301/302, so in order to redirect this action uses <meta http-equiv="refresh"> tag.
Your custom template should contain the tag, every %URL% occurence in the template will be replaced with the actual URL.
For default template see template.html

Config JSON

Fields

links

Object with links. Key is a shortened url key, value is either string or object.
String value will make a redirection URL, object value allows to have grouped/nested URLs.

separators

Array with characters to separate group URL parts. See example below. Default is ["-"]

Example config

{
    "separators": ["-", "/"],
    "links": {
        "foo": "https://google.com",
        "bar": {
            "baz": "https://github.com"
        }
    }
}

This config will produce:

Example usage

uses: zziger/[email protected]
with:
    path: './public'
    json: './config.json'
    template: './mytemplate.html'

GitHub Pages URL shortener is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Use GitHub Pages as your URL shortener
v1.1
Latest

GitHub Pages URL shortener is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.