Skip to content

Commit

Permalink
Add favicons
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrdlicka committed Feb 2, 2024
1 parent 60bf222 commit de32c0f
Show file tree
Hide file tree
Showing 13 changed files with 257 additions and 5 deletions.
20 changes: 19 additions & 1 deletion lib/swapi_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,25 @@ defmodule SWAPIWeb do
"""

def static_paths,
do: ~w(assets downloads fonts images favicon.ico robots.txt sitemap.txt .well-known)
do: [
"assets",
"android-chrome-192x192.png",
"android-chrome-512x512.png",
"apple-touch-icon.png",
"browserconfig.xml",
"downloads",
"fonts",
"favicon.ico",
"favicon-16x16.png",
"favicon-32x32.png",
"images",
"mstile-150x150.png",
"robots.txt",
"safari-pinned-tab.svg",
"site.webmanifest",
"sitemap.txt",
".well-known"
]

def router do
quote do
Expand Down
3 changes: 3 additions & 0 deletions lib/swapi_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
config={SWAPIWeb.SEO.config()}
page_title={assigns[:page_title]}
/>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto%20Slab">
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
Expand Down
11 changes: 7 additions & 4 deletions lib/swapi_web/seo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ defmodule SWAPIWeb.SEO do
SEO definitions
"""

use SWAPIWeb, :verified_routes
use SEO,
json_library: Jason,
site: &__MODULE__.site_config/1,
Expand All @@ -15,11 +16,13 @@ defmodule SWAPIWeb.SEO do

def site_config(_conn) do
SEO.Site.build(
default_title: "SWAPI",
default_title: "Elixir SWAPI",
description: "The Star Wars API",
theme_color: "#FFEE00",
windows_tile_color: "#FFEE00",
mask_icon_color: "#FFEE00"
theme_color: "#2b3035",
windows_tile_color: "#2b3035",
mask_icon_color: "#2b3035",
mask_icon_url: url(~p"/safari-pinned-tab.svg"),
manifest_url: url(~p"/site.webmanifest")
)
end
end
Binary file added priv/static/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions priv/static/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file added priv/static/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified priv/static/favicon.ico
Binary file not shown.
Binary file added priv/static/mstile-150x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
200 changes: 200 additions & 0 deletions priv/static/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions priv/static/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Elixir SWAPI",
"short_name": "The Star Wars API",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#2b3035",
"background_color": "#2b3035",
"display": "standalone"
}

0 comments on commit de32c0f

Please sign in to comment.