Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
18f7b8f
Remove extraneous padding and javascript, add dark mode; todo: mobile…
nathan-contino Oct 22, 2024
0da2ebf
refactor to left side toc and right side page nav, need to make left …
nathan-contino Oct 23, 2024
2bbe65f
Remove checkboxes, make on this page visible on smaller screens, star…
nathan-contino Oct 25, 2024
90e30af
mobile menu working; todo: open and close toc folders
nathan-contino Nov 27, 2024
2881b23
Bold and expand to current page; optimise theme loading time to preve…
nathan-contino Dec 3, 2024
b161535
Merge branch 'develop' into reduce-padding
nathan-contino Dec 3, 2024
32dcbc5
Swap barred logo for solid colored logo
nathan-contino Dec 3, 2024
d3b7019
Refactored the toc and theme javascript into separate files; cleaned …
nathan-contino Dec 3, 2024
f71186f
Tweak accent colour for dark theme, add padding to bottom of docs con…
nathan-contino Dec 4, 2024
da42c69
Improve appearance of side toc; stop on-this-page v footer conflicts;…
nathan-contino Dec 4, 2024
49d898d
improve table appearance in dark mode; fix toc highlight bug with dup…
nathan-contino Dec 4, 2024
d2ccf7c
Add box shadow to searchbar to make toc scrolling hidden bits more ob…
nathan-contino Dec 4, 2024
cb1bd36
Incorporate updated rpi header and footer; improve footer appearance;…
nathan-contino Dec 9, 2024
0103af0
Hide on-this-page until a slightly larger screen size for better Safa…
nathan-contino Dec 9, 2024
72da5ec
Restore legal, copyright, and contribution bits to footer top; preven…
nathan-contino Dec 9, 2024
0be1310
Remove explicit width from container and top-title elements to preven…
nathan-contino Dec 9, 2024
50ba5b6
Maybe fix small-triangles mobile issue
nathan-contino Dec 9, 2024
54f5e4d
Switch to SVG category icon to improve mobile compatibility; improve …
nathan-contino Dec 9, 2024
a28a588
Tweak sidebar size and padding
nathan-contino Dec 10, 2024
0d43af2
Tweak footer to consume all available horizontal width
nathan-contino Dec 10, 2024
673a53c
Improve toc element alignment, boxes landing page search bar appearan…
nathan-contino Dec 10, 2024
49bf5b8
Increase mobile menu button size
nathan-contino Dec 10, 2024
6716e93
Position on-this-page behind footer
nathan-contino Dec 10, 2024
c82e538
improve theme button alignment in sidebar
nathan-contino Dec 10, 2024
ec51bb4
Add highlighting for current anchor point, and anchor parent, in toc
nathan-contino Dec 10, 2024
182494f
UI improvements, including centered content on ultrawide screens and …
nathan-contino Dec 10, 2024
09738a5
Give SoC additional room on flagship table, reduce padding for lists
nathan-contino Dec 10, 2024
f55d1e0
Align search bar on mobile site layout
nathan-contino Dec 11, 2024
1bc73ff
Unify landing page styling and add some slight spacing to tabs on lan…
nathan-contino Dec 11, 2024
f9e443f
Enable tabs on mobile landing pages
nathan-contino Dec 11, 2024
5ec4770
Add small gap between on-this-page highlighting and docs content
nathan-contino Dec 11, 2024
11c7bcb
Constrain size of search bar on landing page
nathan-contino Dec 11, 2024
2bb249a
Lighten code blocks and accent background in light mode; set max page…
nathan-contino Dec 11, 2024
f945ba9
Tweak tab colour for better contrast with code blocks and monospace t…
nathan-contino Dec 11, 2024
fd41a86
Update toc hover colour for new sidebar colour
nathan-contino Dec 11, 2024
2ed5d08
Tweak footer background color to better mesh with new colour palette
nathan-contino Dec 11, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ html: run_ninja

# Build the html output files and additionally run a small webserver for local previews
serve_html: run_ninja
$(JEKYLL_CMD) serve
$(JEKYLL_CMD) serve --watch

# Delete all the files created by the 'html' target
clean_html:
Expand Down
3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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...

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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!

Copy link
Contributor

Choose a reason for hiding this comment

The 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

Expand Down
5 changes: 0 additions & 5 deletions jekyll-assets/_includes/contribute.html

This file was deleted.

7 changes: 0 additions & 7 deletions jekyll-assets/_includes/copyright.html

This file was deleted.

26 changes: 22 additions & 4 deletions jekyll-assets/_includes/footer.html
Copy link
Contributor

Choose a reason for hiding this comment

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

This file (as with header.html) is designed to be shared and updated across the multiple sites that make up raspberrypi.com (e.g. Raspberry Pi Events, PIP, Raspberry Pi ID, the homepage, the news pages, etc.).

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than modifying header.html and footer.html directly and thereby preventing us from easily updating them across the sites, would a middle ground be for you to add your own separate CSS overrides in your own stylesheet until we can upstream dark mode support in the header across the whole site?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it correct that you've got both var(--subtle-text); and var(--subtle); ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One is for subtle text. The other is for subtle UI elements :)

I'll unleash a round of comments and CSS organisation today to note some of my trials and errors for the maintainers of the future.

text-decoration: none;
}
#__rptl-footer .__rptl-footer-link--with-icon {
Expand All @@ -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 &copy; 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">
Expand Down
72 changes: 71 additions & 1 deletion jekyll-assets/_includes/head.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="{{ site.baseurl }}/favicon.ico">
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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">
Expand All @@ -17,9 +18,78 @@
<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">
<script src="{{ site.baseurl }}/scripts/tocbot.js"></script>
<script>
/* Trigger Tocbot dynamic TOC, works with tocbot 3.0.2 */
function makeToc() {
var oldtoc = document.getElementById('toc').nextElementSibling;
var newtoc = document.getElementById('tocbot');
newtoc.setAttribute('id', 'tocbot');
newtoc.setAttribute('class', 'js-toc');
oldtoc.parentNode.replaceChild(newtoc, oldtoc);
tocbot.init({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
smoothScroll: true,
includeHtml: true
});
var handleTocOnResize = function() {
var width = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
if (width < 768) {
tocbot.refresh({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
collapseDepth: 6,
activeLinkClass: 'ignoreactive',
throttleTimeout: 1000,
smoothScroll: true });
}
else {
tocbot.refresh({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
smoothScroll: true });
}
};
window.addEventListener('resize', handleTocOnResize);
handleTocOnResize();
}

// toggles the site theme between dark and light
function toggleTheme() {
// fetch the theme from local storage (if it exists)
var theme = localStorage.getItem('theme');
// if theme them has never been set, or is light, set the theme to the dark symbol in local storage to change it
if (localStorage.getItem('theme') !== null && theme == '🌝' ) {
localStorage.setItem('theme', '🌚');
} else {
// otherwise, the theme is currently set to dark, so set the theme to the light symbol in local storage to change it
localStorage.setItem('theme', '🌝');
}
// finally, toggle the light option off or on the body to change the display of the theme
document.body.classList.toggle('light');
}

// initialises the site theme display
// of key interest here: from the user's perspective, the site defaults to the light theme...
// ...unless your browser uses prefers-color-scheme to ask for a dark theme
// from the site's perspective, we default to a dark theme, but toggle it to a light theme on load if the user doesn't ask for dark.
// why do this? To prevent an annoying light 'flash' for dark theme users. light theme users don't really notice or care if there's a dark anti-flash.
function initTheme() {
// fetch the theme from local storage (if it exists)
var theme = localStorage.getItem('theme');
// if the theme has been set to light (null check to short circuit if not set)
if(theme !== null && theme === '🌝'
// if we can use matchMedia and the browser supports the dark color scheme
|| (window.matchMedia && !window.matchMedia('(prefers-color-scheme: dark)').matches)
&& theme !== '🌚') {
// toggles the theme from the default dark mode to the light version (which actually _shows_ by default to many users)
document.body.classList.toggle('light');
}
}
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-V8TFXM3BKJ"></script>
<script>
window.dataLayer = window.dataLayer || [];
Expand Down
Loading
Loading