Skip to content

ShiftHackZ/GP-Deeplink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Pages deeplink generator

This software allows to generate GitHub Pages static website that will work like URL shortener service, for example it can be used to shorten some really long URL like https://example.com/branch/really/damn/long/url/that/is/hard/to/type/bit?behavior=bubble&bikes=book to something more human-readable like https://yourdomain.com/deeplink, but the final short URL will redirect to the original URL.

The advantage of this method - is you can host your own URL shortener web service on GitHub Pages for free.

Build instructions

  1. Download or clone this repository.
git clone https://github.com/ShiftHackZ/GP-Deeplink.git

Or as an option, you can fork this repository directly with your github account, and deploy it after changing the configuration.

  1. Ensure your system has the make package to build C++ software, for example you can install it on some popular linux distros like this:

On Arch Linux based systems:

sudo pacman -S make

On Debian Linux based systems:

sudo apt install make
  1. Build the gpdeeplink binary.

Navigate to the downloaded or cloned GP-Deeplink directory:

cd GP-Deeplink

Then build the binary:

make

Custom templates

By default default.template is used for static deeplink generator, which just redirects the user to the destination URL. However, you can define your own custom template for every deeplink.

You can find template example here.

Configuration

All the configuration is done in config.json file.

You can find confifuration example here.

Parameters definition:

  • output_folder - Defines the output folder where all of static files will be generated.
  • deeplinks - Defines the array of all available URL deeplinks.
    • template - The template to use for this deeplink.
    • deeplink - The deepling that will be generated and appended to base GitHub pages domain, for example if you define value as direct, in the result the link will be yourdomain.com/direct.
    • url - The URL to use for redirect.

Static site generation

The gpdeeplink contains the commands to operate the GitHub pages static content files for URL deeplinking service.

Clean output

Cleans previously generated static redirect sitemap files, removes the output_folder defined in configuration file.

Usage:

./gpdeeplink clean

Generate static site

Generates a deeplink redirect sitemap files based on config.

Usage:

./gpdeeplink generate

Deployment

To deploy a static site, open your forked repository, and navigate to Settings -> Pages and deploy your /docs folder from the main branch. Also you can configure your deployment to use a custom domain.

The example of my configuration:

Configuration

Functionality example

As the result I created the gpdeeplink to redirect to this GitHub repository.

Try to click url.moroz.cc/gpdeeplink and you will open the same repository.

Also you can view the example of how I manage my own URL shortener service based on this software here.

Credits

This if free software, provided with no warranty, you can use and modify it however you want.

If you find the idea behind this valuable, you can say thanks and show a little support, clicking the button:

"Buy Me A Coffee"

About

GitHub Pages deeplink URL shortener static site generator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages