Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Commit

Permalink
Fix some filtering and searching issues
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Mar 18, 2017
1 parent 1e6a271 commit 59d6853
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ app.get('/tag/:tag', (req, res) => {
// Any other GET is potentially a post or page
app.get('/*', (req, res, notFound) => {
const path = req.path.replace(/(^\/|\/$)/g, '')
const post = req.app.get('posts').findBySlug(path)
let post = req.app.get('posts').findBySlug(path)
if (!post) { post = req.app.get('posts').findBySlug('/' + path) }
if (!post) { return notFound() }

let list
Expand Down Expand Up @@ -93,8 +94,8 @@ app.get('/*', (req, res, notFound) => {
if (previous && previous.isFuture) { previous = null }
if (next && next.isFuture) { next = null }

children = children.filter((p) => !p.isFuture)
parents = parents.filter((p) => !p.isFuture)
children = children.filter(({ post: p }) => !p.isFuture)
parents = parents.filter(({ post: p }) => !p.isFuture)
}

res.view('post', {
Expand Down

0 comments on commit 59d6853

Please sign in to comment.