Skip to content

Commit 6f080ae

Browse files
committed
Leaf trailing slash fixes [wip]
1 parent 5f71af4 commit 6f080ae

File tree

22 files changed

+22
-21
lines changed

22 files changed

+22
-21
lines changed

Chapter 03/myProject/Resources/Views/blog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2>Blog</h2>
44

55
#for(post in posts):
66
<article>
7-
<a href="/#(post.slug)">
7+
<a href="/#(post.slug)/">
88
<img src="#(post.image)">
99
<h3>#(post.title)</h3>
1010
<p>#(post.excerpt)</p>

Chapter 03/myProject/Resources/Views/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1>myPage</h1>
1616

1717
<nav id="navigation">
1818
<a href="/">Home</a> &middot;
19-
<a href="/blog">Blog</a> &middot;
19+
<a href="/blog/">Blog</a> &middot;
2020
<a href="#" onClick="javascript:about();">About</a>
2121
</nav>
2222
</header>

Chapter 03/myProject/Sources/App/Middlewares/ExtendPathMiddleware.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Vapor
1010
struct ExtendPathMiddleware: Middleware {
1111

1212
func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture<Response> {
13-
if !request.url.path.hasSuffix("/") {
13+
if !request.url.path.hasSuffix("/") && !request.url.path.contains(".") {
1414
let response = request.redirect(to: request.url.path + "/", type: .permanent)
1515
return request.eventLoop.makeSucceededFuture(response)
1616
}

Chapter 03/myProject/Sources/App/configure.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public func configure(_ app: Application) throws {
2525
FrontendRouter(),
2626
BlogRouter(),
2727
]
28+
2829
for router in routers {
2930
try router.boot(routes: app.routes)
3031
}

Chapter 04/myProject/Resources/Views/blog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2>Blog</h2>
44

55
#for(post in posts):
66
<article>
7-
<a href="/#(post.slug)">
7+
<a href="/#(post.slug)/">
88
<img src="#(post.image)">
99
<h3>#(post.title)</h3>
1010
<p>#(post.excerpt)</p>

Chapter 04/myProject/Resources/Views/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1>myPage</h1>
1616

1717
<nav id="navigation">
1818
<a href="/">Home</a> &middot;
19-
<a href="/blog">Blog</a> &middot;
19+
<a href="/blog/">Blog</a> &middot;
2020
<a href="#" onClick="javascript:about();">About</a>
2121
</nav>
2222
</header>

Chapter 05/myProject/Sources/App/Modules/Blog/Views/Frontend/Blog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2>Blog</h2>
44

55
#for(post in posts):
66
<article>
7-
<a href="/#(post.slug)">
7+
<a href="/#(post.slug)/">
88
<img src="#(post.image)">
99
<h3>#(post.title)</h3>
1010
<p>#(post.excerpt)</p>

Chapter 05/myProject/Sources/App/Modules/Frontend/Views/Index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1>myPage</h1>
1616

1717
<nav id="navigation">
1818
<a href="/">Home</a> &middot;
19-
<a href="/blog">Blog</a> &middot;
19+
<a href="/blog/">Blog</a> &middot;
2020
<a href="#" onClick="javascript:about();">About</a>
2121
</nav>
2222
</header>

Chapter 06/myProject/Sources/App/Modules/Blog/Views/Frontend/Blog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2>Blog</h2>
44

55
#for(post in posts):
66
<article>
7-
<a href="/#(post.slug)">
7+
<a href="/#(post.slug)/">
88
<img src="#(post.image)">
99
<h3>#(post.title)</h3>
1010
<p>#(post.excerpt)</p>

Chapter 06/myProject/Sources/App/Modules/Frontend/Views/Index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1>myPage</h1>
1616

1717
<nav id="navigation">
1818
<a href="/">Home</a> &middot;
19-
<a href="/blog">Blog</a> &middot;
19+
<a href="/blog/">Blog</a> &middot;
2020
<a href="#" onClick="javascript:about();">About</a>
2121
</nav>
2222
</header>

0 commit comments

Comments
 (0)