Skip to content

Commit 124f85a

Browse files
committed
append .HTML to extensionlist redirects
1 parent ee0af24 commit 124f85a

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

lib/jekyll-redirect-from/redirect_page.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ def set_paths(from, to)
5252
})
5353
end
5454

55-
# Redirects without a trailing slash should produce extentionless files
56-
def output_ext
57-
if File.extname(permalink).empty? && !permalink.end_with?("/")
58-
""
59-
else
60-
_renderer.output_ext
61-
end
62-
end
63-
6455
private
6556

6657
def context

spec/integrations_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
context "pages" do
88
context "single redirect from" do
9-
let(:relative_path) { "some/other/path" }
9+
let(:relative_path) { "some/other/path.html" }
1010

1111
it "exists in the built site" do
1212
expect(path).to exist
@@ -17,7 +17,7 @@
1717
context "multiple redirect froms" do
1818
%w(help contact let-there/be/light-he-said geepers/mccreepin).each do |redirect|
1919
context "the #{redirect} redirect" do
20-
let(:relative_path) { redirect }
20+
let(:relative_path) { "#{redirect}.html" }
2121

2222
it "exists in the built site" do
2323
expect(path).to exist
@@ -48,7 +48,7 @@
4848

4949
context "documents" do
5050
context "a single redirect from" do
51-
let(:relative_path) { "articles/23128432159832/mary-had-a-little-lamb" }
51+
let(:relative_path) { "articles/23128432159832/mary-had-a-little-lamb.html" }
5252

5353
it "exists in the built site" do
5454
expect(path).to exist

spec/jekyll_redirect_from/redirect_page_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
let(:from) { "/foo" }
138138

139139
it "adds .html" do
140-
expected = File.expand_path "foo", site.dest
140+
expected = File.expand_path "foo.html", site.dest
141141
expect(subject.destination("/")).to eql(expected)
142142
end
143143
end
@@ -154,7 +154,7 @@
154154
context "when redirect from is an HTML file" do
155155
let(:from) { "/foo.html" }
156156

157-
it "doesn't add .html" do
157+
it "adds .html" do
158158
expected = File.expand_path "foo.html", site.dest
159159
expect(subject.destination("/")).to eql(expected)
160160
end
@@ -173,7 +173,7 @@
173173
let(:from) { "foo" }
174174

175175
it "adds the slash" do
176-
expected = File.expand_path "foo", site.dest
176+
expected = File.expand_path "foo.html", site.dest
177177
expect(subject.destination("/")).to eql(expected)
178178
end
179179
end
@@ -199,8 +199,8 @@
199199
context "with no slash" do
200200
let(:from) { "foo" }
201201

202-
it "uses no extension" do
203-
expect(subject.output_ext).to eql("")
202+
it "uses HTML" do
203+
expect(subject.output_ext).to eql(".html")
204204
end
205205
end
206206
end

0 commit comments

Comments
 (0)