Skip to content

Commit 9c81898

Browse files
author
Nuno Alexandre
committed
Add new simpler and friendlier favicon
The current favicon doesn't work well in such a small space. Besides that, its transparent background doesn't work well in browsers with dark themes. We agreed to change to a favicon with a haskell-purple background color with the haskell logo. This commit also changes how the favicon is exposed to the browser, by using <link> pointing to a .png file, instead of *.ico as the first appears to be much more size/quality efficient. Since the favicon declaration becomes explicit there is no need to serve the it as a root-level file.
1 parent ad5b227 commit 9c81898

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

Distribution/Server/Features/StaticFiles.hs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,9 @@ staticFilesFeature ServerEnv{serverStaticDir, serverTemplatesMode}
5050
-- resourceGet = [("", \_ -> serveStaticTemplates)]
5151
-- }
5252
, (resourceAt "/static/..") {
53-
resourceGet = [("", \_ -> serveStaticDirFiles)]
53+
resourceGet = [("", const serveStaticDirFiles)]
5454
}
55-
] ++
56-
[ (resourceAt ("/" ++ filename)) {
57-
resourceGet = [("", \_ -> serveStaticToplevelFile mimetype filename)]
58-
}
59-
| (filename, mimetype) <- toplevelFiles ]
55+
]
6056
++
6157
[ (resourceAt ("/" ++ dropExtension name)) {
6258
resourceGet = [("", \_ -> serveStaticTemplate name)]
@@ -136,7 +132,6 @@ staticFilesFeature ServerEnv{serverStaticDir, serverTemplatesMode}
136132
htmlErrorPage GenericErrorResponse =
137133
htmlErrorPage internalServerErrorResponse
138134

139-
toplevelFiles = [("favicon.ico", "image/x-icon")]
140135
toplevelTemplates = map dropExtension staticFiles
141136

142137
addHeaders :: Headers -> [(String, String)] -> Headers

Distribution/Server/Pages/Template.hs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ hackagePageWith headExtra docTitle docSubtitle docContent bodyExtra =
3131
, thelink ! [ rel "stylesheet"
3232
, href stylesheetURL
3333
, thetype "text/css"] << noHtml
34+
, thelink ! [ rel "icon"
35+
, href faviconURL
36+
, thetype "image/png"] << noHtml
3437
, meta ! [ name "viewport"
3538
, content "width=device-width, initial-scale=1"]
3639
-- if Search is enabled
@@ -43,7 +46,6 @@ hackagePageWith headExtra docTitle docSubtitle docContent bodyExtra =
4346
docHeader = [ docSubtitle
4447
, navigationBar
4548
]
46-
googleFontURL = "https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700"
4749

4850
navigationBar :: Html
4951
navigationBar =
@@ -59,9 +61,16 @@ navigationBar =
5961
, anchor ! [href accountsURL] << "User accounts"
6062
]
6163

64+
65+
googleFontURL :: URL
66+
googleFontURL = "https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700"
67+
6268
stylesheetURL :: URL
6369
stylesheetURL = "/static/hackage.css"
6470

71+
faviconURL :: URL
72+
faviconURL = "/static/favion.png"
73+
6574
-- URL of the package list
6675
pkgListURL :: URL
6776
pkgListURL = "/packages/browse"

datafiles/static/favicon.ico

-14.7 KB
Binary file not shown.

datafiles/static/favicon.png

2.73 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<meta name="viewport" content="width=device-width, initial-scale=1">
22
<link href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" rel="stylesheet">
33
<link rel="stylesheet" href="/static/hackage.css" type="text/css" />
4+
<link rel="icon" type="image/png" href="/static/favicon.png" />
45
<link rel="search" type="application/opensearchdescription+xml" title="Hackage" href="/packages/opensearch.xml" />

0 commit comments

Comments
 (0)