moving favicon(s) to config, allowing multiple favicons (#8856)

* moving favicon to config, allowing multiple favicons

* black...
This commit is contained in:
Evan Rusackas 2019-12-20 12:58:36 -08:00 committed by Maxime Beauchemin
parent d0efd0e4c9
commit 36c6f4ca3a
2 changed files with 23 additions and 1 deletions

View File

@ -57,6 +57,17 @@ PACKAGE_DIR = os.path.join(BASE_DIR, "static", "assets")
VERSION_INFO_FILE = os.path.join(PACKAGE_DIR, "version_info.json")
PACKAGE_JSON_FILE = os.path.join(BASE_DIR, "assets", "package.json")
# Multiple favicons can be specified here. The "href" property
# is mandatory, but "sizes," "type," and "rel" are optional.
# For example:
# {
# "href":path/to/image.png",
# "sizes": "16x16",
# "type": "image/png"
# "rel": "icon"
# },
FAVICONS = [{"href": "/static/assets/images/favicon.png"}]
def _try_json_readversion(filepath):
try:

View File

@ -16,7 +16,11 @@
specific language governing permissions and limitations
under the License.
#}
{% import 'appbuilder/general/lib.html' as lib %}
{% set favicons = appbuilder.app.config['FAVICONS'] %}
<html>
<head>
<title>
@ -30,7 +34,14 @@
</title>
{% block head_meta %}{% endblock %}
{% block head_css %}
<link rel="icon" type="image/png" href="/static/assets/images/favicon.png">
{% for favicon in favicons %}
<link
rel="{{favicon.rel if favicon.rel else "icon"}}"
type="{{favicon.type if favicon.type else "image/png"}}"
{% if favicon.sizes %}sizes={{favicon.sizes}}{% endif %}
href="{{favicon.href}}"
>
{% endfor %}
<link rel="stylesheet" type="text/css" href="/static/appbuilder/css/flags/flags16.css" />
<link rel="stylesheet" type="text/css" href="/static/appbuilder/css/font-awesome.min.css">