From db4adf16520dfdeae250780b14cc14f3900dba70 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 3 Nov 2024 18:03:41 +0000 Subject: fix annoyingly oversized link a > h1 results in big text, big link, h1 > a, results in big text, small link, and keeps people with fat thumbs happy --- src/routes/index.js | 6 ++++-- src/views/index.pug | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/routes/index.js b/src/routes/index.js index f7a0425..54a5b18 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -14,9 +14,11 @@ router.get('/', async (req, res) => { router.get('/r/:subreddit', async (req, res) => { var subreddit = req.params.subreddit; var query = req.query? req.query : {}; - var sort = query.sort? query.sort : 'hot'; + if (!query.sort) { + query.sort = 'hot'; + } - var postsReq = G.getSubmissions(sort, `${subreddit}`, query); + var postsReq = G.getSubmissions(query.sort, `${subreddit}`, query); var aboutReq = G.getSubreddit(`${subreddit}`); var [posts, about] = await Promise.all([postsReq, aboutReq]); diff --git a/src/views/index.pug b/src/views/index.pug index 01b2941..f506c09 100644 --- a/src/views/index.pug +++ b/src/views/index.pug @@ -44,13 +44,14 @@ html div.hero div.sub-title - a(href=`/r/${subreddit}`) - h1 r/#{subreddit} + h1 + a(href=`/r/${subreddit}`) + | r/#{subreddit} div#button-container if about p #{about.public_description} details - summary sort by + summary sorting by #{query.sort + (query.t?' '+query.t:'')} div.sort-opts a(href=`/r/${subreddit}?sort=hot`) hot a(href=`/r/${subreddit}?sort=new`) new -- cgit v1.2.3