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

HDDS-9572. Restore favicons from original ozone website #95

Merged
merged 9 commits into from
Jun 21, 2024

Conversation

errose28
Copy link
Contributor

@errose28 errose28 commented May 30, 2024

What changes were proposed in this pull request?

Don't be scared by the line count in this change, it's mostly image files and the auto generated pnpm-lock.

Summary

The current version of the new website only supplies a single favicon .ico file. This works for most cases, but there are other uses where more icons are required. The range of icon types and sizes is somewhat complicated, but there are a few blogs online that attempt to summarize the minimum requirements. I referenced these two to implement these changes:

Browser Icons

For universal compatibility, one favicon.ico at the root of the website is recommended. For sites that support svg icons, we can add a favicon.svg file at the root as well. Docusaurus's favicon config only supports one file, so instead of using that I have used the config to insert head tags specifying both icons.

Web App Icons

To support installing the webpage as a Portable Web Application (PWA), I am using Docusaurus's PWA plugin. It might be doing some magic in the background, but all I've configured is pointing it to the manifest.json file to configure the PWA. FWIW PWA support seemed to work without this plugin by just adding a head tag pointing to the manifest, but using the plugin may cover some corner cases I missed. The manifest file and icons recommended for PWAs by the articles listed above are in the static/pwa directory to distinguish them from the general purpose favicons.

apple-touch-icon.png gets used when a shortcut to the website is created on the home screen of iOS devices. I don't have an iOS devices to test this and I think it would be difficult to test without deploying to the staging site anyways. When installing the site on MacOS as a Safari Web App, I'm pretty sure the PWA config is used instead of apple-touch-icon.

Generating Icons

The Portable Web App icons (in the pwa directory) were generated from the existing Ozone svg logo using https://maskable.app/editor. The 180px apple touch icon is a resized version of the 512px PWA icon. The favicon.ico file came from the original website. The favicon.svg is also from the original Ozone svg logo.

What is the link to the Apache Jira?

HDDS-9572

How was this patch tested?

  • Local preview in Safari and Chrome shows the Favicon correctly.
  • Icon is shown correctly when site is installed as a PWA from Safari
  • Icon is kind of shown correctly when site is installed as a PWA from Chrome
    • For some reason the corners aren't getting rounded, but my understanding is that this should either be done by Chrome running the PWA or MacOS when generating the dock icon and should not be baked into the image.
  • Manual inspection of build/index.html shows that head tags are added correctly:
<link rel="manifest" href="/pwa/manifest.json">
<link rel="icon" href="favicon.ico" sizes="32x32">
<link rel="icon" href="favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="apple-touch-icon.png">

Screenshots

  • Website running as PWA from Safari and its dock icon
    safari_pwa
    safari_pwa_icon

  • Website running as a PWA from Chrome with its dock icon (not rounded for some reason...)
    chrome_pwa
    chrome_pwa_icon

* HDDS-9225-website-v2:
  Bump docusaurus to 3.3.2 (apache#93)
  HDDS-10667. Improvements to spelling checks. (apache#89)
  HDDS-10698. Bump skywalking-eyes to v0.6.0 (apache#90)
  HDDS-10449. Add quick start to the top of contributing guide. (apache#83)
  HDDS-10351. Add GitHub Actions check for yaml formatting (apache#87)
  HDDS-9567. Add GitHub Actions license header check for relevant files. (apache#86)
  HDDS-10506. Reduce directory iterations in sidebar check (apache#85)
  HDDS-9866. Add GitHub Actions checks for consistent Docusaurus formatting. (apache#84)
  HDDS-10254. Add GitHub Actions check for Markdown style. (apache#81)
  HDDS-10349. Add GitHub Actions check for consistent file name formatting. (apache#79)
  HDDS-10426. Crop ozone-logo.svg to a proper size (apache#80)
  HDDS-10353. Add GitHub Actions check of all generated URLs in the sitemap. (apache#77)
  HDDS-9868. Add GitHub Actions check for spelling. (apache#76)
  HDDS-10400. Fix event condition in website publish workflow (apache#78)
  HDDS-10352. Add GitHub Actions workflow to build and run the website. (apache#74)
  HDDS-10222. Add pnpm guide to contributing guide. (apache#64)
  HDDS-10313. Update "Redundant" to "Reliable" in new website. (apache#73)
* HDDS-9225-website-v2:
  HDDS-10903. Move sitemap check to Docusaurus build. (apache#94)
@github-actions github-actions bot added the website-v2 Tasks for the new ozone website targeting the HDDS-9225-website-v2 branch label May 30, 2024
@errose28 errose28 requested a review from dombizita May 30, 2024 21:33
Copy link

@dombizita dombizita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your continuous effort on fixing this @errose28! I tried it locally, it looks good to me, but I don't have too much knowledge around this area (the PR description is really useful, thanks!).
I don't know what could cause the not rounded dock icon, I tried to look into it, maybe if you define the size in the headTags for the apple-touch-icon? I found this while searching in google, highlighting the importance of the icon size.

@errose28
Copy link
Contributor Author

Thanks for the review @dombizita. I'll check the reference you shared and take another stab at getting the rounded icon for the chrome pwa on macos. I think that's a pretty small use case, so we can probably merge this as is if we can't get that one part to work after another attempt.

Copy link

@dombizita dombizita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@errose28 agree, that can be addressed later. +1 for these changes

@errose28
Copy link
Contributor Author

Thanks for the review @dombizita. I think fixing the square icon is going to take more investigation than it is worth right now, so let's merge this to get the rest of the changes in. I think this chrome article might have some pointers we could check if we want to follow up on this in the future.

@errose28 errose28 merged commit 2634864 into apache:HDDS-9225-website-v2 Jun 21, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
website-v2 Tasks for the new ozone website targeting the HDDS-9225-website-v2 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants