Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
0ac5502
Update README.md (#167)
donavanwells Nov 7, 2017
dd5cbc6
Update history to reflect merge of #167 [ci skip]
jekyllbot Nov 7, 2017
37eed64
Rubocop: autocorrect (#165)
jekyllbot Nov 7, 2017
4e7611a
Update history to reflect merge of #165 [ci skip]
jekyllbot Nov 7, 2017
eaa7261
Docs: Plugins is the new gems
DirtyF Dec 3, 2017
5204a09
Security: Bump Rubocop
DirtyF Dec 3, 2017
4158b04
Style: Target Ruby 2.1
DirtyF Dec 3, 2017
50d5493
Dev: Standardize scripts
DirtyF Dec 3, 2017
3da9e18
Bump year
DirtyF Dec 3, 2017
a09ca8f
Dev: Check before release
DirtyF Dec 3, 2017
9d27dc9
Release :gem: 0.13.0
DirtyF Dec 3, 2017
bae143f
Update History.markdown
DirtyF Dec 4, 2017
d6bc536
Update Copyright notice
DirtyF Dec 11, 2017
793b40c
Update LICENSE.txt
DirtyF Jan 3, 2018
394fc8a
Test against Ruby 2.5 (#173)
jekyllbot Feb 3, 2018
5da12f3
Update history to reflect merge of #173 [ci skip]
jekyllbot Feb 3, 2018
97c2841
run javascript at first to avoid splash (#158)
NewFuture Jun 29, 2018
7c0b7c2
Update history to reflect merge of #158 [ci skip]
jekyllbot Jun 29, 2018
083cdcc
Use Rubocop 0.57
DirtyF Jun 29, 2018
78042a3
Target Ruby 2.3
DirtyF Jun 29, 2018
9739a8b
List offenses
DirtyF Jun 29, 2018
e22763b
End testing Ruby 2.2 (EOL)
DirtyF Jun 29, 2018
62c5bb7
Release :gem: v0.14
DirtyF Jun 29, 2018
fbc4eef
Rubocop ~> 0.57.2
DirtyF Jul 11, 2018
464e906
Lint with rubocop-jekyll
DirtyF Jul 24, 2018
80d6610
chore(ci): match GitHub Pages version
DirtyF Oct 26, 2018
32856d7
chore(deps): rubocop-jekyll 0.3 (#187)
jekyllbot Oct 26, 2018
9782c10
Update history to reflect merge of #187 [ci skip]
jekyllbot Oct 26, 2018
b34fff5
chore(deps): rubocop-jekyll 0.4
DirtyF Dec 6, 2018
573d294
style: safe-auto-correct
DirtyF Dec 6, 2018
07b6b3b
style: auo-gen-exclude-only
DirtyF Dec 6, 2018
557cebc
chore(ci): test oldest and latest Ruby versions only
DirtyF Dec 6, 2018
162dd9e
chore(deps): relax version constraint on bundler
DirtyF Jan 6, 2019
a61d30b
chore(ci): Add Ruby 2.6, drop Ruby 2.3
DirtyF Jan 6, 2019
be6c5b2
chore (ci): remove deprecated `sudo: false` in .travis.yml
DirtyF Mar 6, 2019
86e49cf
Allow testing and using with Jekyll 4.x (#196)
ashmaroli Mar 23, 2019
0bde11f
Update history to reflect merge of #196 [ci skip]
jekyllbot Mar 23, 2019
17534dd
Release: v0.15.0
DirtyF Mar 23, 2019
f952abf
Simplifies YAML for redirect_to (#185)
dmalan Mar 23, 2019
d360b87
Update history to reflect merge of #185 [ci skip]
jekyllbot Mar 23, 2019
873f537
Use `Hash#key?` instead of `Hash#keys.any?` (#201)
ashmaroli May 3, 2019
21d18e0
Update history to reflect merge of #201 [ci skip]
jekyllbot May 3, 2019
e1266f1
Stop testing with backwards-compatible site config (#211)
ashmaroli Dec 12, 2019
26d6e61
Update history to reflect merge of #211 [ci skip]
jekyllbot Dec 12, 2019
b708d48
Allows generation of redirects.json to be disabled (#207)
dmalan Jan 26, 2020
5ecf4ce
Update history to reflect merge of #207 [ci skip]
jekyllbot Jan 26, 2020
475bdf9
Allow redirects from and for subclasses of page and document (#204)
Jan 26, 2020
95f3d82
Update history to reflect merge of #204 [ci skip]
jekyllbot Jan 26, 2020
f13c1b7
chore: ignore vendor/bundle
DirtyF Jan 26, 2020
0f93907
chore(deps): target Ruby 2.4
DirtyF Jan 26, 2020
1ecf3cc
chore(release): :gem: v0.16.0
DirtyF Jan 26, 2020
bae0eaa
chore(ci): stop testing Ruby 2.3
DirtyF Jan 27, 2020
52bcaa0
chore(dev): simplify require for version
DirtyF Mar 17, 2020
a36f3cb
chore(ci): bump Ruby versions
DirtyF Apr 13, 2020
65f346c
fix: rubocop cop name
DirtyF Apr 13, 2020
5b5bacd
style: fix Rubocop offenses
DirtyF Apr 13, 2020
e4fb738
style: Style/SpecialGlobalVars (#216)
DirtyF Apr 13, 2020
d1ccfdf
Update history to reflect merge of #216 [ci skip]
jekyllbot Apr 13, 2020
4cc0614
fix Gemfile to correctly install jekyll 3.9 (#224)
satyanash Aug 16, 2020
3520d23
Update history to reflect merge of #224 [ci skip]
jekyllbot Aug 16, 2020
8eff45b
Refactor specs for RedirectPage (#222)
satyanash Sep 14, 2020
18af463
Update history to reflect merge of #222 [ci skip]
jekyllbot Sep 14, 2020
635a78b
chore(ci): GitHub Pages runs Ruby 2.7.1
DirtyF Dec 24, 2020
2a226ed
Fix typo in README
kinow May 5, 2021
8d45b94
Merge pull request #239 from kinow/patch-1
DirtyF Jun 19, 2021
0f07aa0
Add YAML syntax highlighting to README.md (#237)
lemonez Aug 20, 2021
993a507
Add workflow file for Continuous Integration
ashmaroli Aug 22, 2021
e51c141
Refactor Redirectable mixin to reduce allocations (#241)
ashmaroli Aug 26, 2021
03b70ba
Update history to reflect merge of #241 [ci skip]
jekyllbot Aug 26, 2021
0de03e3
Run CI workflow on the `master` branch as well
ashmaroli Aug 27, 2021
de551dd
Lock to RuboCop v1.18.x (#242)
ashmaroli Sep 17, 2021
06701e5
Update history to reflect merge of #242 [ci skip]
jekyllbot Sep 17, 2021
4f93bd2
Test gem install in GH Actions CI
ashmaroli Sep 23, 2021
07cba48
Clean up gemspec (#243)
ashmaroli Sep 27, 2021
6a751b2
Update history to reflect merge of #243 [ci skip]
jekyllbot Sep 27, 2021
1f644b9
Bump versions in CI workflow (#273)
ashmaroli Sep 22, 2024
0378df2
Update history to reflect merge of #273 [ci skip]
jekyllbot Sep 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Continuous Integration

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
ci:
if: "!contains(github.event.commits[0].message, '[ci skip]')"
name: 'Ruby ${{ matrix.ruby_version }}'
runs-on: 'ubuntu-latest'

strategy:
fail-fast: false
matrix:
ruby_version:
- "2.7"
- "3.0"
- "3.3"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
- name: "Set up Ruby ${{ matrix.ruby_version }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Execute tests
run: bash script/test
- name: Check Style Offenses
run: bash script/fmt
- name: Test gem build
run: bundle exec gem build jekyll-redirect-from.gemspec
- name: Test gem install
run: bundle exec gem install jekyll-redirect-from --local --verbose

ghp:
if: "!contains(github.event.commits[0].message, '[ci skip]')"
name: Ruby 3.3 with GitHub Pages Gem
runs-on: 'ubuntu-latest'
env:
GH_PAGES: true
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
- name: "Set up Ruby 3.3"
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: Execute tests
run: bash script/test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pkg
rdoc
spec/reports
spec/fixtures/.jekyll-metadata
spec/fixtures/.jekyll-cache
test/tmp
test/version_tmp
tmp
vendor/bundle
37 changes: 32 additions & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
inherit_from: .rubocop_todo.yml

require: rubocop-jekyll

inherit_gem:
jekyll: .rubocop.yml
rubocop-jekyll: .rubocop.yml

AllCops:
TargetRubyVersion: 2.5
SuggestExtensions: false
Exclude:
- vendor/**/*

Metrics/BlockLength:
Layout/LineEndStringConcatenationIndentation:
Enabled: true

Lint/EmptyInPattern:
Enabled: false

Naming/InclusiveLanguage:
Enabled: false
Naming/MemoizedInstanceVariableName:
Exclude:
- spec/**/*
- 'lib/jekyll-redirect-from/page_without_a_file.rb'

Performance/MapCompact:
Enabled: true
Performance/RedundantEqualityComparisonBlock:
Enabled: true
Performance/RedundantSplitRegexpArgument:
Enabled: true

Metrics/LineLength:
Style/ConcatArrayLiterals:
Exclude:
- spec/**/*
- 'jekyll-redirect-from.gemspec'
Style/InPatternThen:
Enabled: false
Style/MultilineInPatternThen:
Enabled: false
Style/QuotedSymbols:
Enabled: true
27 changes: 27 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2021-09-17 12:49:45 UTC using RuboCop version 1.18.4.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 105

# Offense count: 2
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/jekyll_redirect_from/generator_spec.rb'

# Offense count: 2
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'spec/jekyll_redirect_from/generator_spec.rb'
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

source "https://rubygems.org"
gemspec

if ENV["GH_PAGES"]
gem "github-pages"
end
gem "github-pages" if ENV["GH_PAGES"]
gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"]
gem "kramdown-parser-gfm" if ENV["JEKYLL_VERSION"] == "~> 3.9"
65 changes: 65 additions & 0 deletions History.markdown
Original file line number Diff line number Diff line change
@@ -1,11 +1,72 @@
## HEAD

### styles

* style: Style/SpecialGlobalVars (#216)

### Development Fixes

* fix Gemfile to correctly install jekyll 3.9 (#224)
* Refactor specs for RedirectPage (#222)
* Lock to RuboCop v1.18.x (#242)
* Clean up gemspec (#243)
* Bump versions in CI workflow (#273)

### Bug Fixes

* Refactor Redirectable mixin to reduce allocations (#241)

## 0.16.0 / 2020-01-26

### Minor Enhancements

* Allows generation of `redirects.json` to be disabled (#207)
* Allow redirects from and for subclasses of page and document (#204)

### Bug Fixes

* Use `Hash#key?` instead of `Hash#keys.any?` (#201)

### Development Fixes

* Target Ruby 2.4
* Stop testing with backwards-compatible site config (#211)

### Documentation

* Simplifies YAML for `redirect_to` (#185)

## 0.15.0 / 2019-03-23

### Development Fixes

* chore(deps): rubocop-jekyll 0.3 (#187)

### Bug Fixes

* Allow testing and using with Jekyll 4.x (#196)

## 0.14.0 / 2018-06-29

### Minor Enhancements

* Run javascript at first to avoid splash (#158)

### Development Fixes

* Use Rubocop 0.57
* Target Ruby 2.3
* Test against Ruby 2.5 (#173)

## 0.13.0 / 2017-12-03

* Test against same version of Ruby that GitHub Pages uses (#132)

### Development Fixes

* Rubocop (#141)
* Fix tests for jekyll 3.5.x (#160)
* Rubocop: autocorrect (#165)

### Minor Enhancements

Expand All @@ -17,6 +78,10 @@

* Create redirects.json file (#147)

### Documentation

* Update README.md (#167)

## 0.12.1 / 2017-01-12

### Development Fixes
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013 Parker Moore
Copyright (c) 2013-present Parker Moore and jekyll-redirect-from contributors

MIT License

Expand Down
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impractical to create new pages in the proper subdirectories so they, e.g.
Instead of dealing with maintaining those pages for redirection, let
`jekyll-redirect-from` handle it for you.

[![Build Status](https://travis-ci.org/jekyll/jekyll-redirect-from.svg?branch=master)](https://travis-ci.org/jekyll/jekyll-redirect-from)
[![Build Status](https://github.com/jekyll/jekyll-redirect-from/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jekyll/jekyll-redirect-from/actions/workflows/ci.yml)

## How it Works

Expand All @@ -31,13 +31,15 @@ Or install it yourself as:

$ gem install jekyll-redirect-from

Once it's installed into your evironment, add it to your `_config.yml`:
Once it's installed into your environment, add it to your `_config.yml`:

```yaml
gems:
plugins:
- jekyll-redirect-from
```

💡 If you are using a Jekyll version less than 3.5.0, use the `gems` key instead of `plugins`.

If you're using Jekyll in `safe` mode to mimic GitHub Pages, make sure to
add jekyll-redirect-from to your whitelist:

Expand All @@ -50,7 +52,7 @@ Then run `jekyll <cmd> --safe` like normal.

## Usage

The object of this gem is to allow an author to specify multiple URLs for a
The objective of this gem is to allow an author to specify multiple URLs for a
page, such that the alternative URLs redirect to the new Jekyll URL.

To use it, simply add the array to the YAML front-matter of your page or post:
Expand All @@ -66,7 +68,7 @@ Redirects including a trailing slash will generate a corresponding subdirectory

For example...

```text
```yaml
redirect_from:
- /post/123456789/my-amazing-post
```
Expand All @@ -79,7 +81,7 @@ redirect_from:

While...

```text
```yaml
redirect_from:
- /post/123456789/my-amazing-post/
```
Expand All @@ -94,7 +96,7 @@ These pages will contain an HTTP-REFRESH meta tag which redirect to your URL.

You can also specify just **one url** like this:

```text
```yaml
title: My other awesome post
redirect_from: /post/123456798/
```
Expand All @@ -111,13 +113,9 @@ Sometimes, you may want to redirect a site page to a totally different website.

```yaml
title: My amazing post
redirect_to:
- http://www.github.com
redirect_to: http://www.github.com
```

If you have multiple `redirect_to`s set, only the first one will be respected.


**Note**: Using `redirect_to` or `redirect_from` with collections will only work with files which are output to HTML, such as `.md`, `.textile`, `.html` etc.

## Customizing the redirect template
Expand All @@ -129,6 +127,19 @@ Your layout will get the following variables:
* `page.redirect.from` - the relative path to the redirect page
* `page.redirect.to` - the absolute URL (where available) to the target page

## Configuration

You can configure this plugin in `_config.yml` by adding to the `redirect_from` key.

### Disabling `redirects.json`

By default, a file called `redirects.json`, which can be used for automated testing or to implement server-side redirects, will be included in the output. To exclude it from the output, set the `json` key to `false`:

```yml
redirect_from:
json: false
```

## Contributing

1. Fork it
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

Expand Down
Loading