From ed6b15f8c4ee1597ad7cf53081459b2165a21cae Mon Sep 17 00:00:00 2001 From: "v.kholyavka" Date: Fri, 14 Dec 2018 15:41:36 +0200 Subject: [PATCH 1/3] Added favicon --- arctic/generics.py | 4 ++++ arctic/templates/arctic/partials/head.html | 2 ++ docs/reference.md | 3 +++ 3 files changed, 9 insertions(+) diff --git a/arctic/generics.py b/arctic/generics.py index aff2f7ab..99220f5f 100755 --- a/arctic/generics.py +++ b/arctic/generics.py @@ -109,6 +109,7 @@ def get_context_data(self, **kwargs): context["SITE_NAME"] = self.get_site_name() context["SITE_TITLE"] = self.get_site_title() context["SITE_LOGO"] = self.get_site_logo() + context["SITE_FAVICON"] = self.get_site_favicon() context["SIDEBAR_BACKGROUND"] = self.get_sidebar_background() context["SIDEBAR_COLOR"] = self.get_sidebar_color() context["SIDEBAR_ALT_COLOR"] = self.get_sidebar_alt_color() @@ -181,6 +182,9 @@ def get_page_description(self): def get_site_logo(self): return arctic_setting("ARCTIC_SITE_LOGO") + def get_site_favicon(self): + return getattr(settings, "ARCTIC_SITE_FAVICON", "/static/favicon.ico") + def get_site_name(self): return arctic_setting("ARCTIC_SITE_NAME") diff --git a/arctic/templates/arctic/partials/head.html b/arctic/templates/arctic/partials/head.html index fc0924ef..f96fb400 100644 --- a/arctic/templates/arctic/partials/head.html +++ b/arctic/templates/arctic/partials/head.html @@ -5,6 +5,8 @@ + + {% block title %} {{ SITE_TITLE }} – {{ page_title }} diff --git a/docs/reference.md b/docs/reference.md index 6a129b64..5bf37f35 100755 --- a/docs/reference.md +++ b/docs/reference.md @@ -81,6 +81,9 @@ if not provided, a default color will be used. String representing the foreground color of the sidebar, for example '#ffffff', if not provided, a default color will be used. +## `ARCTIC_SITE_FAVICON` +The url of favicon. It will will be displayed on all pages next to site title. + ## `ARCTIC_SITE_LOGO` The url of the logo to be displayed on every page, it will also be the link to From 842dce801cc2d3d547be6900f7ff624c5f6cdf2e Mon Sep 17 00:00:00 2001 From: "v.kholyavka" <volodymyr.kholyavka@levi9.com> Date: Mon, 17 Dec 2018 13:50:16 +0200 Subject: [PATCH 2/3] Removed link type. Changed doc --- arctic/templates/arctic/partials/head.html | 2 +- docs/reference.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arctic/templates/arctic/partials/head.html b/arctic/templates/arctic/partials/head.html index f96fb400..7d9f8204 100644 --- a/arctic/templates/arctic/partials/head.html +++ b/arctic/templates/arctic/partials/head.html @@ -5,7 +5,7 @@ <meta name="description" content=""> <meta name="author" content=""> -<link rel="shortcut icon" type="image" href="{% static SITE_FAVICON %}"/> +<link rel="shortcut icon" href="{% static SITE_FAVICON %}"/> <title> {% block title %} diff --git a/docs/reference.md b/docs/reference.md index 5bf37f35..c9dbd67c 100755 --- a/docs/reference.md +++ b/docs/reference.md @@ -82,7 +82,7 @@ String representing the foreground color of the sidebar, for example '#ffffff', if not provided, a default color will be used. ## `ARCTIC_SITE_FAVICON` -The url of favicon. It will will be displayed on all pages next to site title. +The url of favicon. ## `ARCTIC_SITE_LOGO` From 44584435081796ccf1d5bffd1e17116b40a2d41d Mon Sep 17 00:00:00 2001 From: "v.kholyavka" <volodymyr.kholyavka@levi9.com> Date: Tue, 18 Dec 2018 12:35:50 +0200 Subject: [PATCH 3/3] Set default favicon value to not defined instead of hardcoded --- arctic/generics.py | 2 +- arctic/templates/arctic/partials/head.html | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arctic/generics.py b/arctic/generics.py index 99220f5f..496c0c36 100755 --- a/arctic/generics.py +++ b/arctic/generics.py @@ -183,7 +183,7 @@ def get_site_logo(self): return arctic_setting("ARCTIC_SITE_LOGO") def get_site_favicon(self): - return getattr(settings, "ARCTIC_SITE_FAVICON", "/static/favicon.ico") + return getattr(settings, "ARCTIC_SITE_FAVICON", None) def get_site_name(self): return arctic_setting("ARCTIC_SITE_NAME") diff --git a/arctic/templates/arctic/partials/head.html b/arctic/templates/arctic/partials/head.html index 7d9f8204..0d6c14c0 100644 --- a/arctic/templates/arctic/partials/head.html +++ b/arctic/templates/arctic/partials/head.html @@ -5,7 +5,9 @@ <meta name="description" content=""> <meta name="author" content=""> -<link rel="shortcut icon" href="{% static SITE_FAVICON %}"/> +{% if SITE_FAVICON %} + <link rel="shortcut icon" href="{% static SITE_FAVICON %}"/> +{% endif %} <title> {% block title %}