Show tweet/user count in the main page

This commit is contained in:
Christine Dodrill 2016-02-11 07:44:45 -08:00
parent adab4a23fd
commit ac6dd0f0e3
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,7 @@
<p>welcome to the twtxt list. this is an openly available list of users of <a href="https://github.com/buckket/twtxt">twtxt</a>, the decentralized microblogging tool. this will poll every submitted user every 5 minutes to update its view.</p> <p>welcome to the twtxt list. this is an openly available list of users of <a href="https://github.com/buckket/twtxt">twtxt</a>, the decentralized microblogging tool. this will poll every submitted user every 5 minutes to update its view.</p>
<p>this site currently indexes {{ users }} users and {{ tweets }} tweets.</p>
<h3>links</h3> <h3>links</h3>
<ul> <ul>

View File

@ -55,7 +55,15 @@ settings:
routes: routes:
get "/": get "/":
renderMustache("home", indexTemplate, newContext()) var ctx = newContext()
let
users = db.getValue sql"select count(*) from users"
tweets = db.getValue sql"select count(*) from tweets"
ctx["users"] = users
ctx["tweets"] = tweets
renderMustache("home", indexTemplate, ctx)
get "/changelog": get "/changelog":
const log = staticExec "git log -10" const log = staticExec "git log -10"