diff --git a/config/settings.yml b/config/settings.yml index 9975484..a783573 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -33,5 +33,6 @@ database: title: 00dani.me app-name: lebd +username: dani repository: https://gitlab.com/00dani/lebd #analytics: UA-YOURCODE diff --git a/src/Handler/Home.hs b/src/Handler/Home.hs index dd81310..5e2ad57 100644 --- a/src/Handler/Home.hs +++ b/src/Handler/Home.hs @@ -14,8 +14,9 @@ import Widget.Feed ( hFeed ) getHomeR :: Handler Html getHomeR = do - userE@(Entity userId user) <- runDB . getBy404 $ UniqueUser "dani" - title <- asks $ siteTitle . appSettings + settings <- asks appSettings + userE@(Entity userId user) <- runDB . getBy404 . UniqueUser . siteUsername $ settings + let title = siteTitle settings entries <- runDB $ selectList [EntryAuthorId ==. userId] [Desc EntryPublished] defaultLayout $ do atomLink FeedR title diff --git a/src/Settings.hs b/src/Settings.hs index 3f73892..0212013 100644 --- a/src/Settings.hs +++ b/src/Settings.hs @@ -64,6 +64,9 @@ data AppSettings = AppSettings -- ^ Google Analytics code , siteTitle :: Text -- ^ Site-wide title. + , siteUsername :: Text + -- ^ Username of the site's main user, whose h-card will appear on the + -- homepage. , appAuthDummyLogin :: Bool -- ^ Indicate if auth dummy login should be enabled. @@ -94,6 +97,7 @@ instance FromJSON AppSettings where appAnalytics <- o .:? "analytics" siteTitle <- o .: "title" + siteUsername <- o .: "username" -- This code enables MySQL's strict mode, without which MySQL will truncate data. -- See https://github.com/yesodweb/persistent/wiki/Database-Configuration#strict-mode for details