Skip to content

A GitHub Action to setup a project URL shortener on GitHub Pages.

Notifications You must be signed in to change notification settings

zziger/url-shortener-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/url-shortener-action@v1.1
with:
    path: './public'
    json: './config.json'
    template: './mytemplate.html'

About

A GitHub Action to setup a project URL shortener on GitHub Pages.

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published