No release in over 3 years
Low commit activity in last 3 years
Jekyll filter that uses Bit.ly to shorten URLs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

~> 3.0.0
~> 1.0.0
 Project Readme

Jekyll Bitly Next

Tests

A modern, maintained Jekyll plugin that provides Bitly URL shortening filters for your Jekyll sites.

๐Ÿ”— About

This gem is a maintained fork of jekyll-bitly, which is no longer actively maintained. It provides seamless integration with Bitly's API to automatically shorten URLs in your Jekyll pages and posts.

โœจ Features

  • ๐Ÿš€ Simple Liquid filter for URL shortening
  • ๐Ÿ” Secure token management via config or environment variables
  • ๐Ÿ’พ Automatic caching of shortened URLs
  • ๐ŸŽฏ Zero configuration required after token setup
  • ๐Ÿงช Fully tested and maintained

๐Ÿ“ฆ Installation

Using Bundler (Recommended)

Add this line to your Gemfile:

gem 'jekyll_bitly_next'

Then execute:

bundle install

Manual Installation

gem install jekyll_bitly_next

Configure Jekyll

Add the plugin to your _config.yml:

plugins:
  - jekyll_bitly_next

Note: Older Jekyll versions used gems: instead of plugins:. If you're using an older version, use:

gems:
  - jekyll_bitly_next

๐Ÿ”‘ Configuration

Step 1: Get Your Bitly API Token

  1. Log in to your Bitly account
  2. Navigate to https://app.bitly.com/settings/api/
  3. Generate a new API token
  4. Copy the token for use in the next step

Step 2: Configure the Token

You can configure your Bitly token using either of these methods:

Option 1: Jekyll Config (Recommended for local development)

Add to your _config.yml:

bitly:
  token: YOUR_BITLY_API_TOKEN_HERE

โš ๏ธ Security Warning: Never commit your API token to public repositories. Add _config.yml to .gitignore or use environment variables for production.

Option 2: Environment Variable (Recommended for production)

Set the BITLY_TOKEN environment variable:

# Linux/macOS
export BITLY_TOKEN=YOUR_BITLY_API_TOKEN_HERE

# Windows (Command Prompt)
set BITLY_TOKEN=YOUR_BITLY_API_TOKEN_HERE

# Windows (PowerShell)
$env:BITLY_TOKEN="YOUR_BITLY_API_TOKEN_HERE"

For permanent setup, add it to your .bashrc, .zshrc, or system environment variables.

Priority: Config file settings take precedence over environment variables.

๐Ÿš€ Usage

Basic Usage

Use the bitly filter in your Jekyll templates, pages, or posts:

[Visit the Bitly gem]({{ 'https://github.com/philnash/bitly' | bitly }})

Advanced Examples

In blog posts:

---
layout: post
title: "My Awesome Post"
canonical_url: https://yourdomain.com/2025/10/awesome-post
---

Share this post: {{ page.canonical_url | bitly }}

In layouts:

<a href="{{ page.url | absolute_url | bitly }}" class="share-link">
  Share on Twitter
</a>

With site variables:

{% assign short_url = site.url | append: page.url | bitly %}
<meta property="og:url" content="{{ short_url }}" />

๐Ÿ› ๏ธ Development

Prerequisites

  • Ruby 2.7 or higher
  • Bundler

Setup

  1. Clone the repository:
git clone https://github.com/saiqulhaq/jekyll_bitly_next.git
cd jekyll_bitly_next
  1. Install dependencies:
bin/setup
# or
bundle install
  1. Run the tests:
bundle exec rspec
  1. Run an interactive console:
bin/console

Making Changes

  1. Create a feature branch: git checkout -b my-feature
  2. Make your changes
  3. Add tests for your changes
  4. Run tests: bundle exec rspec
  5. Commit your changes: git commit -am 'Add new feature'
  6. Push to the branch: git push origin my-feature
  7. Create a Pull Request

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. Report bugs: Open an issue on GitHub
  2. Suggest features: Open an issue with your ideas
  3. Submit pull requests: Fork, create a feature branch, and submit a PR
  4. Improve documentation: Help us make the docs better

Please note that this project is released with a Contributor Code of Conduct. By participating in this project, you agree to abide by its terms.

๐Ÿ“ Changelog

See CHANGELOG.md for a list of changes in each version.

๐Ÿ“„ License

This gem is available as open source under the terms of the MIT License.

๐Ÿ™ Credits