This repository has been archived by the owner on Dec 2, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirect from old html pages to new Octopress pages
Redirects are handled by the jekyll_alias_generator Octopress plugin https://github.com/tsmango/jekyll_alias_generator
- Loading branch information
1 parent
a9076e1
commit 90c56a3
Showing
22 changed files
with
190 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Alias Generator for Posts. | ||
# | ||
# Generates redirect pages for posts with aliases set in the YAML Front Matter. | ||
# | ||
# Place the full path of the alias (place to redirect from) inside the | ||
# destination post's YAML Front Matter. One or more aliases may be given. | ||
# | ||
# Example Post Configuration: | ||
# | ||
# --- | ||
# layout: post | ||
# title: "How I Keep Limited Pressing Running" | ||
# alias: /post/6301645915/how-i-keep-limited-pressing-running/index.html | ||
# --- | ||
# | ||
# Example Post Configuration: | ||
# | ||
# --- | ||
# layout: post | ||
# title: "How I Keep Limited Pressing Running" | ||
# alias: [/first-alias/index.html, /second-alias/index.html] | ||
# --- | ||
# | ||
# Author: Thomas Mango | ||
# Site: http://thomasmango.com | ||
# Plugin Source: http://github.com/tsmango/jekyll_alias_generator | ||
# Site Source: http://github.com/tsmango/thomasmango.com | ||
# PLugin License: MIT | ||
|
||
module Jekyll | ||
|
||
class AliasGenerator < Generator | ||
|
||
def generate(site) | ||
@site = site | ||
|
||
process_posts | ||
process_pages | ||
end | ||
|
||
def process_posts | ||
@site.posts.each do |post| | ||
generate_aliases(post.url, post.data['alias']) | ||
end | ||
end | ||
|
||
def process_pages | ||
@site.pages.each do |page| | ||
generate_aliases(page.destination('').gsub(/index\.(html|htm)$/, ''), page.data['alias']) | ||
end | ||
end | ||
|
||
def generate_aliases(destination_path, aliases) | ||
alias_paths ||= Array.new | ||
alias_paths << aliases | ||
alias_paths.compact! | ||
|
||
alias_paths.flatten.each do |alias_path| | ||
# If alias_path has an extension, we'll write the alias file | ||
# directly to that path. Otherwise, we'll assume that the | ||
# alias_path is a directory, in which case we'll generate an | ||
# index.html file. | ||
alias_dir = File.extname(alias_path).empty? ? alias_path : File.dirname(alias_path) | ||
alias_file = File.extname(alias_path).empty? ? "index.html" : File.basename(alias_path) | ||
|
||
fs_path_to_dir = File.join(@site.dest, alias_dir) | ||
alias_index_path = File.join(alias_dir, alias_file) | ||
|
||
FileUtils.mkdir_p(fs_path_to_dir) | ||
|
||
File.open(File.join(fs_path_to_dir, alias_file), 'w') do |file| | ||
file.write(alias_template(destination_path)) | ||
end | ||
|
||
(alias_index_path.split('/').size + 1).times do |sections| | ||
@site.static_files << Jekyll::AliasFile.new(@site, @site.dest, alias_index_path.split('/')[0, sections].join('/'), nil) | ||
end | ||
end | ||
end | ||
|
||
def alias_template(destination_path) | ||
<<-EOF | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="canonical" href="#{destination_path}"/> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<meta http-equiv="refresh" content="0;url=#{destination_path}" /> | ||
</head> | ||
</html> | ||
EOF | ||
end | ||
end | ||
|
||
class AliasFile < StaticFile | ||
require 'set' | ||
|
||
def destination(dest) | ||
File.join(dest, @dir) | ||
end | ||
|
||
def modified? | ||
return false | ||
end | ||
|
||
def write(dest) | ||
return true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="canonical" href="/city/"/> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<meta http-equiv="refresh" content="0;url=/city/" /> | ||
</head> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="canonical" href="/conference/"/> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<meta http-equiv="refresh" content="0;url=/conference/" /> | ||
</head> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="canonical" href="/policies/"/> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<meta http-equiv="refresh" content="0;url=/policies/" /> | ||
</head> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="canonical" href="/sponsors/"/> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<meta http-equiv="refresh" content="0;url=/sponsors/" /> | ||
</head> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
sharing: false | ||
footer: true | ||
body_id: "city" | ||
alias: /city.html | ||
--- | ||
|
||
<h2>PITTSBURGH</h2> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
comments: true | ||
sharing: false | ||
footer: false | ||
alias: /policies.html | ||
--- | ||
|
||
<h2> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
sharing: false | ||
footer: true | ||
body_id: "sponsors" | ||
alias: /sponsors.html | ||
--- | ||
|
||
<h2>OUR SPONSORS</h2> | ||
|