-
Notifications
You must be signed in to change notification settings - Fork 2k
Actual mobile toc; dark mode; speed up site loading #3950
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
Changes from 12 commits
18f7b8f
0da2ebf
2bbe65f
90e30af
2881b23
b161535
32dcbc5
d3b7019
f71186f
da42c69
49d898d
d2ccf7c
cb1bd36
0103af0
72da5ec
0be1310
50ba5b6
54f5e4d
a28a588
0d43af2
673a53c
49bf5b8
6716e93
c82e538
ec51bb4
182494f
09738a5
f55d1e0
1bc73ff
f9e443f
5ec4770
11c7bcb
2bb249a
f945ba9
fd41a86
2ed5d08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,9 @@ title: Raspberry Pi Documentation | |
| description: >- # this means to ignore newlines until "baseurl:" | ||
| Raspberry Pi Documentation. | ||
| baseurl: "/documentation" # the subpath of your site, e.g. /blog | ||
| url: "" # the base hostname & protocol for your site, e.g. http://example.com | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sure that there must have been some reason why this was left empty; but that reason is probably now lost to the mists of time... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might have an impact on the URLs used for the rptl header. Need to double-check the behaviour on a staging build before I release! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The header uses all absolute URLs so it shouldn’t be affected. |
||
| url: "https://www.raspberrypi.com/documentation" # the base hostname & protocol for your site, e.g. http://example.com | ||
| githuburl: "https://github.com/raspberrypi/documentation/" | ||
| mainsite: https://raspberrypi.com/ | ||
| githubbranch: master | ||
| githubbranch_edit: develop | ||
|
|
||
|
|
||
This file was deleted.
This file was deleted.
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file (as with If you make changes here, they'll be lost whenever we need to update it for changes to the header or footer or are you wanting to break away from the site-wide versions and have a documentation-only version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To support dark mode, we do need to tweak the header and footer files, as otherwise they'll remain in light mode at all times. I've kept the tweaks minimal (mostly colour based, with some padding trimmed from the header to reduce excess space usage), so we could try to mostly share. But unless we add dark mode to the main site as well, this will require deviation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that this PR is modifying both the navigation and also adding a dark-mode, I wonder if it might be worth splitting that into two separate PRs? I.e. get the navigation changes merged in, and then add dark-mode theme as separate (later) step? 🤔 Or would it be far too much work to disentangle the two things? Also, we'll probably want @jackbenwillis to design us some "light mode" and "dark mode" icons which would integrate with the design better than the generic sun and moon icons that you're currently using? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than modifying There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great point. Opened https://github.com/raspberrypi/raspberrypi.com-header-and-footer/pull/81 to address this -- once we've merged that, I'll update this PR to use that new approach (and likely some new header and footer-specific variables). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ | |
| text-size-adjust: 100%; | ||
| -webkit-font-smoothing: antialiased; | ||
| -moz-osx-font-smoothing: grayscale; | ||
| background: #f5f6f9; | ||
| background: var(--footer-bg); | ||
| overflow: hidden; | ||
| } | ||
| #__rptl-footer .__rptl-footer-container { | ||
|
|
@@ -63,7 +63,7 @@ | |
| } | ||
| #__rptl-footer .__rptl-footer-heading { | ||
| font-weight: 700; | ||
| color: #333333; | ||
| color: var(--subtle-text); | ||
| margin-bottom: 8px; | ||
| } | ||
| #__rptl-footer .__rptl-footer-list { | ||
|
|
@@ -75,11 +75,11 @@ | |
| } | ||
| #__rptl-footer .__rptl-footer-icon { | ||
| margin-right: 0.5em; | ||
| fill: #333; | ||
| fill: var(--subtle-text); | ||
| } | ||
| #__rptl-footer .__rptl-footer-link, #__rptl-footer .__rptl-footer-link--with-icon { | ||
| font-weight: 400; | ||
| color: #333; | ||
| color: var(--subtle); | ||
|
||
| text-decoration: none; | ||
| } | ||
| #__rptl-footer .__rptl-footer-link--with-icon { | ||
|
|
@@ -90,6 +90,24 @@ | |
| text-decoration: underline; | ||
| } | ||
| </style> | ||
|
|
||
| <div class="legal"> | ||
| <div class="legal-inner"> | ||
| <p id="copyright"> | ||
| You can view and edit the Raspberry Pi documentation source <a href="{{ site.githuburl }}">on Github</a>. Please read our <a href="{{ site.githuburl }}blob/{{ site.githubbranch }}/CONTRIBUTING.md">usage and contributions policy</a> before you make a Pull Request. | ||
| </p> | ||
| <p id="copyright"> | ||
| Raspberry Pi documentation is copyright © 2012-{{ site.time | date: '%Y' }} Raspberry Pi Ltd and is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</a> (CC BY-SA) licence. | ||
| </p> | ||
| <p id="copyright"> | ||
| Some content originates from the <a href="http://elinux.org/">eLinux wiki</a>, and is licensed under a <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported</a> licence. | ||
| </p> | ||
| <p id="copyright"> | ||
| The terms HDMI, HDMI High-Definition Multimedia Interface, HDMI trade dress and the HDMI Logos are trademarks or registered trademarks of HDMI Licensing Administrator, Inc. | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
| <footer id="__rptl-footer"> | ||
| <div class="__rptl-footer-container"> | ||
| <div class="__rptl-footer-row"> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| <meta charset="utf-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <link rel="shortcut icon" href="{{ site.baseurl }}/favicon.ico"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this different to the default behaviour of using https://www.raspberrypi.com/favicon.ico? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, local builds of the docs yell at you on the CLI about a missing favicon and lack a favicon entirely. I added this to fix the issue locally, and I think it shouldn't break anything. Though your sanity check is appreciated. Hopefully that makes sense now. |
||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <title>{{ page.title | strip_html}}</title> | ||
| <meta name="description" content="The official documentation for Raspberry Pi computers and microcontrollers"> | ||
| <meta property="og:title" content="{{ page.title }}"> | ||
| <meta property="og:description" content="The official documentation for Raspberry Pi computers and microcontrollers"> | ||
| <meta property="og:url" content="https://www.raspberrypi.com{{ page.url | relative_url }}"> | ||
| <meta property="og:image" content="https://www.raspberrypi.com{{ "/images/opensocial.png" | relative_url }}"> | ||
| <meta property="og:image" content="https://www.raspberrypi.com{{ '/images/opensocial.png' | relative_url }}"> | ||
| <meta name="twitter:card" content="summary_large_image"> | ||
| <meta name="twitter:site" content="@Raspberry_Pi"> | ||
| <meta name="twitter:title" content="{{ page.title }}"> | ||
|
|
@@ -17,9 +18,15 @@ | |
| <link rel="preconnect" href="https://IHWGNTJ1NP-dsn.algolia.net" crossorigin> | ||
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3"/> | ||
| <link rel="stylesheet" href="{{ site.baseurl }}/css/style.css?ver={{ site.time | date: '%s' }}"> | ||
| <link rel="stylesheet" href="{{ site.baseurl }}/css/tabs.css?ver={{ site.time | date: '%s' }}"> | ||
| <link rel="stylesheet" href="{{ site.baseurl }}/css/asciidoctor-tabs.css?ver={{ site.time | date: '%s' }}"> | ||
| <link rel="stylesheet" href="{{ site.baseurl }}/css/syntax-highlighting.css?ver={{ site.time | date: '%s' }}"> | ||
| <link rel="stylesheet" href="{{ site.baseurl }}/css/tocbot.css?ver={{ site.time | date: '%s' }}"> | ||
| <script type="text/javascript" src="{{ site.baseurl }}/scripts/theme.js?ver={{ site.time | date: '%s' }}"></script> | ||
| <script type="text/javascript" src="{{ site.baseurl }}/scripts/tocbot.js?ver={{ site.time | date: '%s' }}"></script> | ||
| <script type="text/javascript" src="{{ site.baseurl }}/scripts/toc.js?ver={{ site.time | date: '%s' }}"></script> | ||
| <script async type="text/javascript" src="{{ site.baseurl }}/scripts/asciidoctor-tabs.js?ver={{ site.time | date: '%s' }}"></script> | ||
| <script async src="{{ site.baseurl }}/scripts/clipboard.min.js?ver={{ site.time | date: '%s' }}"></script> | ||
| <script async src="{{ site.baseurl }}/scripts/copy-to-clipboard.js?ver={{ site.time | date: '%s' }}"></script> | ||
| <script async src="https://www.googletagmanager.com/gtag/js?id=G-V8TFXM3BKJ"></script> | ||
| <script> | ||
| window.dataLayer = window.dataLayer || []; | ||
|
|
||
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <div id="theme-toggle-container"> | ||
| <a id="theme-toggle" alt="toggle site theme" title="toggle site theme" onclick="toggleTheme()"></a> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better to be unobtrusive here and add a e.g. document.getElementById("theme-toggle").addEventListener("click", (e) => {
e.preventDefault();
toggleTheme();
});There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that this ultimately does the exact same thing, but with an element lookup. Is there a performance benefit that I'm not aware of, or some penalty to using onclick? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my other comment re separating the HTML from the JavaScript but also the broader concept of unobtrusive JavaScript to encourage progressive enhancement. |
||
| </div> | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,20 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| {% include head.html %} | ||
| <link rel="stylesheet" href="{{ site.baseurl }}/css/boxes.css?ver={{ site.time | date: '%s' }}"> | ||
| {% include head.html %} | ||
| </head> | ||
| <body> | ||
| {% include header.html %} | ||
| {% if page.name == "404.adoc" %} | ||
| {% include toptitle404.html %} | ||
| {% include subtitle404.html %} | ||
| {% else %} | ||
| {% include toptitle.html %} | ||
| {% include subtitle.html %} | ||
| {% endif %} | ||
| {% include tabs.html %} | ||
| <body onload="makeToc()"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above re being unobtrusive: could you fire document.addEventListener("DOMContentLoaded", () => {
makeToc();
});There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar question as the toggle comment above -- happy to move the call, but I'd like to know if there's a performance or organisational benefit before I do that! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you can extract all your JavaScript into a separate file then it can be cached across page loads and served from our CDN while the HTML is typically always loaded from the origin servers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, gotcha. I can pull the makeToc and theme stuff into a separate file, but the inline toc manipulation will have to stay here as it's part of the static site generation process. |
||
| <script type="text/javascript">initTheme()</script> | ||
| {% include header.html %} | ||
|
|
||
| <div class="toptitle"> | ||
| <h1><a href="/documentation/">Raspberry Pi Documentation</a></h1> | ||
| <div id="search-theme-toggle-container"> | ||
| <div id="docsearch"></div> | ||
| {% include theme.html %} | ||
| </div> | ||
| {% include tabs.html %} | ||
| </div> | ||
|
|
||
| <div id="container"> | ||
| <section id="box-content"> | ||
|
|
@@ -35,9 +36,7 @@ | |
| </section> | ||
| </div> | ||
|
|
||
| {% include contribute.html %} | ||
| {% include copyright.html %} | ||
| {% include footer.html %} | ||
| {% include footer.html %} | ||
| {% include search.html %} | ||
|
|
||
| </body> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.