Skip to content

Commit

Permalink
fix: allow slash at end of url
Browse files Browse the repository at this point in the history
  • Loading branch information
prplwtf committed Nov 22, 2024
1 parent a85de46 commit 834fddd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/sections/BlogSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function BlogSection() {
<div class="rounded-4 bg-dark-subtle position-relative" style="--mdc-ripple-hover-opacity: .02; --mdc-ripple-focus-opacity: .02; --mdc-ripple-press-opacity: .05;">
${PostThumbnail}
<div class="row d-flex p-4">
<div class="col-10 me-auto">
<div class="col-auto col-sm-10 me-auto">
<span writea="post.entry.info" class="d-block text-primary-emphasis mb-1">
${Post.Topic || "post"}
<span class="text-dark"><i class="bi bi-dot"></i> ${Post.Content}</span>
Expand All @@ -43,7 +43,7 @@ function BlogSection() {
${Post.Description || "No description available"}
</span>
</div>
<div class="col-auto my-auto">
<div class="col-auto my-auto d-none d-sm-block">
<button type="button" class="btn shadow-none text-primary-emphasis"><i class="bi bi-chevron-right"></i></button>
</div>
</div>
Expand Down
11 changes: 10 additions & 1 deletion src/router/Route.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ async function Route(view) {
Unload("Section")
ProgressBar(25)

// Allow URLs ending in a slash
if(view.endsWith('/')) {
let lastIndex = view.lastIndexOf('/');
view =
view.slice(0, lastIndex) +
'' +
view.slice(lastIndex + 1);
}


// #
if(view == "" || view == "#") {
Expand Down Expand Up @@ -44,7 +53,7 @@ async function Route(view) {
}

// #404
console.info(`View ${view} not found, returning 404.`)
console.warn(`404: ${view} not found.`)
return Import("./src/components/sections/NotfoundSection.js", "Section", function() {
App.innerHTML = `${NotfoundSection()}`
ModifyAppTitle("404")
Expand Down

0 comments on commit 834fddd

Please sign in to comment.