GitHub Action
GitHub Pages URL shortener
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.
Path to the uploaded website root
Default: .
Path to a config JSON file.
Default: links.json
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
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.
Array with characters to separate group URL parts. See example below.
Default is ["-"]
{
"separators": ["-", "/"],
"links": {
"foo": "https://google.com",
"bar": {
"baz": "https://github.com"
}
}
}
This config will produce:
- foo -> https://google.com
- bar-baz -> https://github.com
- bar/baz -> https://github.com
uses: zziger/[email protected]
with:
path: './public'
json: './config.json'
template: './mytemplate.html'