Skip to content

Commit

Permalink
doc: Ensure website favicons render correctly on all platforms (Robot…
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesnape authored Mar 15, 2021
1 parent e8f59d2 commit 03969a9
Show file tree
Hide file tree
Showing 12 changed files with 154 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ WORKSPACE diff=python
**/*.bazel diff=python
**/*.bzl diff=python
**/*.cps diff=json
**/site.webmanifest diff=json

# These lines tell git diff viewers to ignore data objects.
# Wavefront geometry definition
Expand Down
35 changes: 34 additions & 1 deletion doc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,45 @@ drake_py_library(
deps = ["@rules_python//python/runfiles"],
)

# For maximum browser compatibility these should be at the root of the
# generated website and should not be renamed.
filegroup(
name = "favicon",
srcs = [
# Manual resizing and padding of "assets/drake-dragon.png" to
# 192x192px.
"android-chrome.png",
# Manual resizing and padding of "assets/drake-dragon.png" to
# 180x180px.
"apple-touch-icon.png",
# Minimal configuration for Microsoft browsers. Versions of Edge prior
# to the change to WebKit always request a file named
# "browserconfig.xml" whether or not an alternative is specified in the
# HTML.
"browserconfig.xml",
# Apple Safari always requests a file named "favicon.ico" whether or
# not an alternative favicon is specified in the HTML.
# Manual resizing and padding of "assets/drake-dragon.png" to 32x32px
# and conversion to ICO format.
"favicon.ico",
# Manual resizing and padding of "assets/drake-dragon.png" to 32x32px.
"favicon.png",
# Mask icon for Safari pinned tabs.
# Manual removal of colors and layers from "assets/drake-dragon.svg"
# and transformation to a 0 0 16 16 view box.
"mask-icon.svg",
# Site manifest primarily for Android and Chrome.
# https://developer.mozilla.org/en-US/docs/Web/Manifest
"site.webmanifest",
],
)

filegroup(
name = "images",
srcs = [
"images/drake-dragon.png",
"images/drake-logo.svg",
"images/drake-logo-white.svg",
"images/favicon.png",
"images/jenkins_bot_reviewable_comment.png",
],
)
Expand Down Expand Up @@ -77,6 +109,7 @@ filegroup(
"assets/**/*.js",
]),
data = [
":favicon",
":images",
":third_party_data",
],
Expand Down
6 changes: 5 additions & 1 deletion doc/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="msapplication-config" content="{{ '/browserconfig.xml' | relative_url }}"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta charset="utf-8"/>
<link rel="shortcut icon" href="{{ '/images/favicon.png' | relative_url }}"/>
<link rel="apple-touch-icon" type="image/png" href="{{ '/apple-touch-icon.png' | relative_url }}"/>
<link rel="manifest" type="application/manifest+json" href="{{ '/site.webmanifest' | relative_url }}"/>
<link rel="mask-icon" type="image/svg+xml" href="{{ '/mask-icon.svg' | relative_url }}" color="#990000"/>
<link rel="shortcut icon" type="image/png" href="{{ '/favicon.png' | relative_url }}"/>
<title>Drake: {{ page.title }}</title>
<meta
name="description"
Expand Down
Binary file added doc/android-chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions doc/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication></msapplication>
</browserconfig>
Binary file added doc/favicon.ico
Binary file not shown.
Binary file added doc/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion doc/images/favicon.README.txt

This file was deleted.

Binary file removed doc/images/favicon.png
Binary file not shown.
98 changes: 98 additions & 0 deletions doc/mask-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions doc/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Drake",
"icons": [
{
"src": "android-chrome.png",
"sizes": "192x192",
"type": "image/png"
}
],
"background_color": "#000000",
"theme_color": "#990000"
}

0 comments on commit 03969a9

Please sign in to comment.