diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index d061cbe3b..000000000 Binary files a/favicon.ico and /dev/null differ diff --git a/hdbt.theme b/hdbt.theme index e457d7afd..f4697fea4 100644 --- a/hdbt.theme +++ b/hdbt.theme @@ -110,6 +110,11 @@ function hdbt_preprocess_html(&$variables) { else { $variables['#attached']['library'][] = 'hdbt/nav-local'; } + + // Add theme path to as variable. + $variables['theme_path'] = '/' . \Drupal::service('theme_handler') + ->getTheme('hdbt') + ->getPath(); } /** diff --git a/modules/hdbt_content/hdbt_content.install b/modules/hdbt_content/hdbt_content.install index 16b20e5e8..88ba0b5e1 100644 --- a/modules/hdbt_content/hdbt_content.install +++ b/modules/hdbt_content/hdbt_content.install @@ -263,3 +263,45 @@ function hdbt_content_install_block_translations(array $translations, string $bl ->save(); } } + +/** + * Manually update HDBT and HDBT Subtheme favicon settings. + */ +function hdbt_content_update_9006() { + $theme_handler = Drupal::service('theme_handler'); + $config_factory = \Drupal::configFactory(); + + // Handle HDBT theme. + if ($theme_handler->themeExists('hdbt')) { + + // Update HDBT favicon settings. + $hdbt = $config_factory->getEditable('hdbt.settings'); + $hdbt_data = $hdbt->getRawData(); + if (!empty($hdbt_data)) { + $hdbt_data['favicon']['path'] = ''; + $hdbt_data['favicon']['use_default'] = 0; + $hdbt->setData($hdbt_data)->save(TRUE); + } + } + + // Handle HDBT Subtheme. + if ($theme_handler->themeExists('hdbt_subtheme')) { + + // Update HDBT favicon settings. + $hdbt_subtheme = $config_factory->getEditable('hdbt_subtheme.settings'); + $hdbt_subtheme_data = $hdbt_subtheme->getRawData(); + if (!empty($hdbt_subtheme_data)) { + $hdbt_subtheme_data['favicon']['path'] = ''; + $hdbt_subtheme_data['favicon']['use_default'] = 0; + } + else { + $hdbt_subtheme_data = [ + 'favicon' => [ + 'use_default' => 0, + 'path' => '', + ], + ]; + } + $hdbt_subtheme->setData($hdbt_subtheme_data)->save(TRUE); + } +} diff --git a/src/images/favicon/LICENCE.txt b/src/images/favicon/LICENCE.txt new file mode 100755 index 000000000..b35194b6c --- /dev/null +++ b/src/images/favicon/LICENCE.txt @@ -0,0 +1 @@ +This work is lisenced under CC BY 4.0, except where otherwise stated. The City of Helsinki logo is a registered trademark. The Helsinki Grotesk Typeface is a proprietary typeface licensed by Camelot Typefaces. diff --git a/src/images/favicon/README.md b/src/images/favicon/README.md new file mode 100644 index 000000000..03de5ba66 --- /dev/null +++ b/src/images/favicon/README.md @@ -0,0 +1,26 @@ +# HDS Favicon kit + +Here are the favicons to be used on desktop and mobile web browsers. If you need the Helsinki-logo for general use instead it is available on [the Helsinki brand site](https://brand.hel.fi/tunnus/). + +The favicons are available in the following sizes and formats: + +* favicon-32x32.ico (32x32px) + +* favicon.svg (512x512px, dark mode support) + +* apple-touch-icon.png (180x180px) + +* favicon-192x192.png (192x192px, webmanifest) + +* favicon-512x512.png (512x512px, webmanifest) + +#### How to use favicons + +1. Deploy the favicon image and manifest files to your CDN. + +2. Add the tags to your index.html between the tags and update image file paths if needed. + + + + + diff --git a/src/images/favicon/apple-touch-icon.png b/src/images/favicon/apple-touch-icon.png new file mode 100644 index 000000000..8f076d104 Binary files /dev/null and b/src/images/favicon/apple-touch-icon.png differ diff --git a/src/images/favicon/favicon-192x192.png b/src/images/favicon/favicon-192x192.png new file mode 100644 index 000000000..1a93ad136 Binary files /dev/null and b/src/images/favicon/favicon-192x192.png differ diff --git a/src/images/favicon/favicon-32x32.ico b/src/images/favicon/favicon-32x32.ico new file mode 100644 index 000000000..5cfbe2555 Binary files /dev/null and b/src/images/favicon/favicon-32x32.ico differ diff --git a/src/images/favicon/favicon-512x512.png b/src/images/favicon/favicon-512x512.png new file mode 100644 index 000000000..b927e7860 Binary files /dev/null and b/src/images/favicon/favicon-512x512.png differ diff --git a/src/images/favicon/favicon.svg b/src/images/favicon/favicon.svg new file mode 100644 index 000000000..851ff986a --- /dev/null +++ b/src/images/favicon/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/images/favicon/manifest.webmanifest b/src/images/favicon/manifest.webmanifest new file mode 100644 index 000000000..1b1a4fe3f --- /dev/null +++ b/src/images/favicon/manifest.webmanifest @@ -0,0 +1,11 @@ +{ + "short_name": "hel.fi", + "name": "Helsingin kaupunki", + "icons": [ + { "src": "/favicon-192x192.png", "type": "image/png", "sizes": "192x192" }, + { "src": "/favicon-512x512.png", "type": "image/png", "sizes": "512x512" } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "browser" +} diff --git a/templates/layout/html.html.twig b/templates/layout/html.html.twig index 28367b51c..399cca790 100644 --- a/templates/layout/html.html.twig +++ b/templates/layout/html.html.twig @@ -53,6 +53,10 @@ {{ head_title|safe_join(' | ') }} + + + +