Skip to content

Commit 85421cd

Browse files
robobarioSamBarker
authored andcommitted
Use the layout and include the version
Signed-off-by: Robert Young <[email protected]> Signed-off-by: Sam Barker <[email protected]>
1 parent 2b3282d commit 85421cd

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ vendor
77
*.iml
88
*/bootstrap/
99
_config-overrides.yml
10+
.ruby-version

_layouts/redirect.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<meta http-equiv="refresh" content=00; url={{ target }}>
5+
<meta http-equiv="refresh" content="0; url={{ page.target }}">
66
</head>
77
<body>
8-
Redirecting to <a href="{{ target }}">{{ target }}</a>...
8+
Redirecting to <a href="{{ page.target }}">{{ page.target }}</a>...
99
</body>
1010
</html>

_plugins/redirector.rb

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,11 @@ def initialize(site, group, redirectConfig, mapping)
3030
@name = basename + ext # basically @basename + @ext.
3131
@layout = 'redirect.html'
3232

33-
@content = "#{redirectConfig['baseUrl']}#{mapping['path']}"
34-
35-
# Initialize data hash with a key pointing to all posts under current category.
36-
# This allows accessing the list in a template via `page.linked_docs`.
3733
@data = {
38-
'version' => mapping['fromVersion'],
39-
'target' => redirectConfig['baseUrl'] + mapping['path'],
34+
'target' => redirectConfig['baseUrl'] + mapping['fromVersion'] + mapping['path'],
35+
'layout' => 'redirect'
4036
}
4137

42-
# # Look up front matter defaults scoped to type `categories`, if given key
43-
# # doesn't exist in the `data` hash.
44-
data.default_proc = proc do |_, key|
45-
site.frontmatter_defaults.find(relative_path, type, key)
46-
end
4738
Jekyll.logger.info "generated redirect page #{@dir}#{@basename}"
4839
end
4940

0 commit comments

Comments
 (0)