Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vucko130 committed Apr 5, 2024
0 parents commit 057b853
Show file tree
Hide file tree
Showing 16 changed files with 284 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
_site/
.jekyll-cache/
.jekyll-metadata
5 changes: 5 additions & 0 deletions 404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
permalink: /404.html
---

Sorry, we can't find that page that you're looking for.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
anchr.cf
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Lars Erik Storbukås

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
167 changes: 167 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<h1 align="center">
<br>
:link:
<br>
</h1>

<h4 align="center">A website for <a href="https://fiy.no/" target="_blank">URL shortener</a>.</h4>

<p align="center">
<a href="https://fiy.no/">
<img src="https://img.shields.io/website-up-down-green-red/http/fiy.no.svg">
</a>
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/License-MIT-blue.svg">
</a>
</p>

# URL shortener

URL shortener with Jekyll and Github pages

> Create short URLs that can be easily shared, tweeted, or emailed to friends. Fork this repo to get started.
## Getting Started

Follow these steps to create your own URL Shortener:

1. Get a domain name
2. Configure the DNS for the domain
3. Fork or clone this repo
4. Edit the `_config.yml` file
5. Host on GitHub Pages
6. Create link pages

### Domain

Get a *(preferably short)* domain name from your favorite [registrar](https://www.icann.org/registrar-reports/accredited-list.html).

Add CNAME

### Configuration

Edit the `_config.yml` file:

```yml
name: URL Shortener

title: URL Shortener
description: Create short URLs that can be easily shared, tweeted, or emailed to friends.

version: v0.1

baseurl: ""
permalink: /:slug/

plugins:
- jekyll-redirect-from

collections:
urls:
output: true
permalink: /:slug

whitelist:
- jekyll-redirect-from

redirect_from:
json: false

include:
- _urls
```
The global `permalink` for pages is set to `/:slug/`.

> Permalinks are the output path for your pages, posts, or collections. They allow you to structure the directories of your source code different from the directories in your output.

> Slugified title from the document’s filename (any character except numbers and letters is replaced as hyphen). May be overridden via the document’s `slug` front matter.

Read more about permalinks at https://jekyllrb.com/docs/permalinks/

It is the `jekyll-redirect-from` plugin that does the redirecting from the *short link* to the *target page*.

> Sometimes, you may want to redirect a site page to a totally different website.

Read more about the plugin at https://github.com/jekyll/jekyll-redirect-from

You can find more useful `plugins` to add at https://pages.github.com/versions/

When running Jekyll locally, uncomment the `repository` line and point to your own GitHub repo.

### GitHub Pages

Go to the repo [/settings](../../settings) and scroll down to the **GitHub Pages** section.

Set the `Source` to `master branch`: https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/

Point the `Custom domain` to your domain name: https://help.github.com/articles/using-a-custom-domain-with-github-pages/

This will create a `CNAME` file in the repo:

```txt
example.com
```

> Custom domains are stored in a `CNAME` file in the root of your repository. You can add or update your custom domain through your repository settings. You can also edit the file directly to update your custom domain.

Read more about adding a custom domain at https://help.github.com/articles/adding-or-removing-a-custom-domain-for-your-github-pages-site/

Make sure the `Enforce HTTPS` checkbox is ticked: https://help.github.com/articles/securing-your-github-pages-site-with-https/

> HTTPS provides a layer of encryption that prevents others from snooping on or tampering with traffic to your site. When HTTPS is enforced, your site will only be served over HTTPS.

Read more about GitHub Pages at https://pages.github.com

## Links

Create a new short link by creating a page: https://jekyllrb.com/docs/pages/

Create the file in the _urls folder of the repository.

This repository has an example, [`repo.md`](repo.md):

```md
---
redirect_to: https://github.com/storbukas/url-shortener
---
```

This results in:

* "Short" link: https://fiy.no/repo
* Target page: https://github.com/storbukas/url-shortener

The `redirect_to` is the URL to the target page. This is the only [front matter](https://jekyllrb.com/docs/front-matter/) that is mandatory to make the short link work.

The file can have a `.md` (Markdown) or `.html` extension.

By default, the file name will be the *slug* of the short link. This behavior is configured in `_config.yml`.

If you want to use a different slug, set the `permalink` variable:

```md
permalink: /something/
```

Take the opportunity to get a real short slug by using *emojis*:

```md
permalink: /😻/
```

Find appropriate emojis to copy from https://www.emojicopy.com

## Built With

* Jekyll: https://jekyllrb.com
* jekyll-redirect-from: https://github.com/jekyll/jekyll-redirect-from
* GitHub Pages: https://pages.github.com

## License

This project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - see the [LICENSE](LICENSE) file for details

## Credits

- [hlaueriksson](https://github.com/hlaueriksson)/[jekyll-url-shortener](https://github.com/hlaueriksson/jekyll-url-shortener) - Inspired and based upon
36 changes: 36 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: URL Shortener

title: URL Shortener
description: Create short URLs that can be easily shared, tweeted, or emailed to friends.

version: v0.2

baseurl: ""
permalink: /:slug/
logo: /assets/logo.png

theme: jekyll-theme-minimal

plugins:
- jekyll-redirect-from

collections:
urls:
output: true
permalink: /:slug

whitelist:
- jekyll-redirect-from

redirect_from:
json: false

include:
- _urls

exclude:
- Gemfile
- Gemfile.lock
- LICENSE
- README.md
- CNAME
18 changes: 18 additions & 0 deletions _layouts/redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>Redirecting...</title>
<link rel="canonical" href="{{ page.redirect.to }}">
<script>location = "{{ page.redirect.to }}"</script>
<meta http-equiv="refresh" content="0; url={{ page.redirect.to }}">
<meta name="robots" content="noindex">
</head>

<body>
<h1>Redirecting...</h1>
<a href="{{ page.redirect.to }}">Click here if you are not redirected.</a>
</body>

</html>
3 changes: 3 additions & 0 deletions _urls/repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: https://github.com/storbukas/url-shortener
---
3 changes: 3 additions & 0 deletions _urls/rvcli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: https://github.com/Vucko130/revanced-cli
---
3 changes: 3 additions & 0 deletions _urls/rvma.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: https://github.com/Vucko130/revanced-magisk-module/releases
---
3 changes: 3 additions & 0 deletions _urls/rvpa.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: https://github.com/Vucko130/revanced-patches
---
3 changes: 3 additions & 0 deletions _urls/sammo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: https://www.sammobile.com/samsung/galaxy-a54-5g/firmware/#SM-A546E
---
3 changes: 3 additions & 0 deletions _urls/spotx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: https://github.com/Vucko130/SpotX-Win
---
3 changes: 3 additions & 0 deletions _urls/xda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redirect_to: https://xdaforums.com/f/samsung-galaxy-a54-5g.12705/
---
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
layout: default
---

{% assign redirects = site.urls | where_exp: "item", "item.redirect_to != nil" %}

{% for page in redirects %}
[{{ page.url }}]({{ page.url | relative_url }}) `{{ page.redirect_to }}`

---
{% endfor %}

0 comments on commit 057b853

Please sign in to comment.