Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable favicon #184

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ header-dark: false # Inverts the text/logo to work better on dark bac
header-transparent: false # Allows the fixed header to be transparent over the page
sticky-footer: true # Causes the footer to be sticky at the bottom of the page
blog-page: '/blog' # The route to the blog listing page, useful for a blog style layout with sidebar
custom_logo: # A custom logo rather than the default (see below)
custom_logo: # A custom logo rather than the default (see below)
custom_logo_mobile: # A custom logo to use for mobile navigation
custom_favicon: # A custom favicon rather than the default (see below)
```

To make modifications, you can copy the `user/themes/quark/quark.yaml` file to `user/config/themes/` folder and modify, or you can use the admin plugin.
Expand All @@ -71,13 +72,15 @@ To make modifications, you can copy the `user/themes/quark/quark.yaml` file to `

## Custom Logos

To add a custom logo, you should put the log into the `user/themes/quark/images/logo` folder. Standard image formats are support (`.png`,`.jpg`, `.gif`, `.svg`, etc.). Then reference the logo via the YAML like so:
To add a custom logo or favicon, you should put the log into the `user/themes/quark/images/logo` folder. Standard image formats are support (`.png`,`.jpg`, `.gif`, `.svg`, etc.). Then reference the logo via the YAML like so:

```yaml
custom_logo:
- name: 'my-logo.png'
custom_logo_mobile:
- name: 'my-mobile-logo.png'
- name: 'my-mobile-logo.png'
custom_favicon:
- name: 'my-favicon.png'
```

Alternatively, you can you use the drag-n-drop "Custom Logo" field in the Quark theme options.
Expand Down
12 changes: 12 additions & 0 deletions blueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ form:
accept:
- image/*

custom_favicon:
type: file
label: Custom Favicon
size: large
destination: 'theme://images/logo'
multiple: false
markdown: true
description: Will be used instead of default favicon `theme://images/favicon.png`. See <a href="https://en.wikipedia.org/wiki/Favicon" target="_blank">Favicon</a> for more details.
accept:
- image/*
- application/octet-stream

header-fixed:
type: toggle
label: Fixed header
Expand Down
3 changes: 2 additions & 1 deletion templates/partials/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
{% include 'partials/metadata.html.twig' %}

<link rel="icon" type="image/png" href="{{ url('theme://images/favicon.png') }}" />
{% set favicon = theme_var('custom_favicon') %}
<link rel="icon" type="{% if favicon %}{{ (favicon|first).type }}{% else %}image/png{% endif %}" href="{% if favicon %}{{ url('theme://images/logo/' ~ (favicon|first).name) }}{% else %}{{ url('theme://images/favicon.png') }}{% endif %}" />
<link rel="canonical" href="{{ page.url(true, true) }}" />
{% endblock head %}

Expand Down