Skip to content

Commit

Permalink
Merge pull request #156 from communitiesuk/favicon
Browse files Browse the repository at this point in the history
changes to allow for custom favicon
  • Loading branch information
kateriley1 authored Apr 25, 2024
2 parents 6a64f05 + fe9a6c0 commit ad97f54
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Binary file added gov_uk_dashboards/assets/images/dluhc_favicon.ico
Binary file not shown.
File renamed without changes.
3 changes: 2 additions & 1 deletion gov_uk_dashboards/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<head>
{%metas%}
<title>{%title%}</title>
{%favicon%} {%css%}
<link rel="icon" href="{{favicon_path}}" type="image/x-icon">
{%css%}
<meta
name="viewport"
content="width=device-width, initial-scale=1, viewport-fit=cover"
Expand Down
6 changes: 4 additions & 2 deletions gov_uk_dashboards/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import os


def read_template() -> str:
def read_template(favicon_path: str = r"assets\images\gov_favicon.ico") -> str:
"""
Read the government html template.
Args:
favicon_path (str): Optional file path to favicon.
:return: String version of the template.
"""
path = os.path.dirname(__file__)
path = os.path.join(path, "template.html")
with open(path, encoding="utf-8") as file:
template = file.read()
return template
return template.replace("{{favicon_path}}", favicon_path)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
author="Department for Levelling Up, Housing and Communities",
description="Provides access to functionality common to creating a data dashboard.",
name="gov_uk_dashboards",
version="9.31.1",
version="9.32.0",
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(),
Expand Down

0 comments on commit ad97f54

Please sign in to comment.