Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Project titles and banners link to a repository's HTTP(S) `homepage`, or its Git
homepage is configured. Set that field to the project's public site, including its new subdomain.
The consumer does not infer a site URL from an organization or repository name.

### Shared navigation

`url-canonical` in `_config_theme.yml` is the main-site address used by the shared brand, navigation, and footer links.
Project pages keep their own `url` and `baseurl` for assets and database requests. Read the Docs project previews link
to the published main site; previews of the main site override `url-canonical` with their own version path.

### CrowdIn Localization

<p align="center">
Expand Down
1 change: 1 addition & 0 deletions _config_theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ share-links-active:
vk: false
remove-ads: true # remove the "Powered by Beautiful Jekyll" text in the footer
url-pretty: "app.LizardByte.dev"
url-canonical: "https://app.lizardbyte.dev"
title-on-all-pages: true
excerpt_length: 50
feed_show_excerpt: true
Expand Down
6 changes: 3 additions & 3 deletions _includes/footer-extra.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% include open-in-new-window.html %}

<a title="Privacy Policy" href="{{ '/privacy' | relative_url }}" class="text_muted">Privacy</a>
<a title="Privacy Policy" href="{% include shared-site-url.html path='/privacy' %}" class="text_muted">Privacy</a>
&nbsp;&bull;&nbsp;
<a title="Terms and Conditions" href="{{ '/terms' | relative_url }}" class="text_muted">Terms</a>
<a title="Terms and Conditions" href="{% include shared-site-url.html path='/terms' %}" class="text_muted">Terms</a>
&nbsp;&bull;&nbsp;
<a title="Licenses and Attribution" href="{{ '/licenses' | relative_url }}" class="text_muted">Licenses</a>
<a title="Licenses and Attribution" href="{% include shared-site-url.html path='/licenses' %}" class="text_muted">Licenses</a>
95 changes: 95 additions & 0 deletions _includes/nav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<nav class="navbar navbar-expand-xl navbar-light fixed-top navbar-custom {% if page.nav-short %}top-nav-short-permanent{% else %}top-nav-regular{% endif %}">
<div class="container-fluid">

{%- if site.title-img -%}
<a class="navbar-brand navbar-brand-logo" href="{% include shared-site-url.html path='/' %}"><img alt="{{ site.title }} Logo" src="{{ site.title-img | relative_url}}"/></a>
{%- elsif site.title -%}
<a class="navbar-brand" href="{% include shared-site-url.html path='/' %}">{{ site.title }}</a>
{%- endif -%}

<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="main-navbar">
<ul class="navbar-nav ms-auto">
{%- for link in site.navbar-links -%}
{%- if link[1].first %}
<li class="nav-item dropdown">
<button class="nav-link dropdown-toggle" id="navbarDropdown{{ forloop.index }}" type="button" data-bs-toggle="dropdown" aria-expanded="false">{{ link[0] }}</button>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown{{ forloop.index }}">
{%- for childlink in link[1] -%}
{%- for linkparts in childlink %}
{%- assign navbar_link_url = linkparts[1] -%}
<a class="dropdown-item" href="{% include shared-site-url.html path=navbar_link_url %}">{{ linkparts[0] }}</a>
{%- endfor -%}
{%- endfor %}
</div>
</li>
{% else %}
<li class="nav-item">
{%- assign navbar_link_url = link[1] -%}
<a class="nav-link" href="{% include shared-site-url.html path=navbar_link_url %}">{{ link[0] }}</a>
</li>
{%- endif -%}
{%- endfor -%}
{% if site.theme-switcher != false %}
{% assign theme_style = site.theme-switcher-style | default: 'button' %}
{% if theme_style == 'dropdown' %}
<li class="nav-item dropdown">
<button class="nav-link dropdown-toggle" id="themeDropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false" title="Change theme">
<span id="theme-icon-dropdown" class="fas fa-fw fa-circle-half-stroke"></span>
<span class="d-xl-none ms-1">Theme</span>
</button>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="themeDropdown">
<a class="dropdown-item" href="#" data-bs-theme-value="light">
<span class="fas fa-fw fa-sun me-2"></span>Light
</a>
<a class="dropdown-item" href="#" data-bs-theme-value="dark">
<span class="fas fa-fw fa-moon me-2"></span>Dark
</a>
<a class="dropdown-item" href="#" data-bs-theme-value="auto">
<span class="fas fa-fw fa-circle-half-stroke me-2"></span>Auto
</a>
</div>
</li>
{% else %}
<li class="nav-item">
<button class="nav-link" id="theme-toggle" type="button" title="Toggle theme (currently: auto)">
<span id="theme-icon-button" class="fas fa-fw fa-circle-half-stroke"></span>
<span class="d-xl-none ms-1">Theme</span>
</button>
</li>
{% endif %}
{%- endif -%}
{% if site.post_search %}
<li class="nav-item">
<a class="nav-link" id="nav-search-link" href="#" title="Search">
<span id="nav-search-icon" class="fa fa-fw fa-search"></span>
<span id="nav-search-text">Search</span>
</a>
</li>
{%- endif -%}
</ul>
</div>

{% if site.navbar-extra %}
{% for file in site.navbar-extra %}
{% include {{ file }} %}
{% endfor %}
{% endif %}

{% if site.avatar and page.show-avatar != false %}
<div class="avatar-container">
<div class="avatar-img-border">
<a href="{{ '/' | relative_url }}">
<img alt="Navigation bar avatar" class="avatar-img" src="{{ site.avatar | relative_url }}" />
</a>
</div>
</div>
{% endif %}

</div>
</nav>

{% include search.html %}
13 changes: 13 additions & 0 deletions _includes/shared-site-url.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{%- assign shared_path = include.path | default: '' -%}
{%- assign shared_first = shared_path | slice: 0, 1 -%}
{%- assign shared_prefix = shared_path | slice: 0, 2 -%}
{%- if shared_path contains ':' or shared_prefix == '//' or shared_first == '#' -%}
{{- shared_path | escape -}}
{%- else -%}
{%- assign shared_base = site.url-canonical | default: site.root_baseurl | default: '' -%}
{%- assign shared_last = shared_base | slice: -1, 1 -%}
{%- if shared_first == '/' -%}
{%- assign shared_path = shared_path | remove_first: '/' -%}
{%- endif -%}
{{- shared_base | escape -}}{%- unless shared_last == '/' -%}/{%- endunless -%}{{- shared_path | escape -}}
{%- endif -%}
2 changes: 1 addition & 1 deletion _includes/support.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h3 class="fw-bolder">Support Center</h3>
– Confucius.
</p>
<div class="input-group mb-2">
<a href="{{ site.root_baseurl }}/support">
<a href="{% include shared-site-url.html path='/support' %}">
<button class="btn btn-outline-light rounded-0"
id="button-support"
type="button"
Expand Down
99 changes: 86 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"jest": "30.5.2",
"jest-environment-jsdom": "30.5.2",
"jest-junit": "17.0.0",
"js-yaml": "5.5.0",
"liquidjs": "10.30.1",
"npm-run-all2": "9.0.4"
},
"repository": {
Expand Down
10 changes: 7 additions & 3 deletions scripts/readthedocs_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,23 @@ cd "${TMPDIR}"
gem install bundle
bundle install
echo "baseurl: ${READTHEDOCS_VERSION}" > _config_rtd.yml
# Shared root links need the preview prefix without consumer repository paths.
echo "root_baseurl: /${READTHEDOCS_VERSION}" >> _config_rtd.yml
if [[ "${sub_project}" == "false" ]]; then
# Main-site pages exist in this preview; consumer previews link to the published main site.
echo "root_baseurl: /${READTHEDOCS_VERSION}" >> _config_rtd.yml
echo "url-canonical: /${READTHEDOCS_VERSION}/" >> _config_rtd.yml
fi
echo "_config_rtd.yml:"
cat _config_rtd.yml
echo "_config_theme.yml:"
cat _config_theme.yml

config_files=_config_rtd.yml,_config_theme.yml
config_files=_config_theme.yml
if [[ -n "${config_file}" ]] && [[ -e "${config_file}" ]]; then
config_files="${config_files},${config_file}"
echo "config file: ${config_file}"
cat "${config_file}"
fi
config_files="${config_files},_config_rtd.yml"

bundle exec jekyll build \
--future \
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/shared-navigation/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{%- comment -%}Search UI rendering is independent of the shared navigation URL tests.{%- endcomment -%}
Loading
Loading