-
Notifications
You must be signed in to change notification settings - Fork 79
docs: migrate docs hosting site to ubuntu.com/docs (Infra) #2718
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
Open
tang-mm
wants to merge
6
commits into
main
Choose a base branch
from
docs-url-migration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d9025e5
feat(docs): enable Google Analytics cookie banner in html templates
tang-mm 179ff41
feat(docs): add js to overwrite links in RTD fly-out
tang-mm 2e139a5
chore(docs): update URL and sitemap config
tang-mm 7f95015
feat(docs): switch to existing RTD project address
tang-mm 298c433
chore(docs): update edit button and related links
tang-mm 14117d8
reformat
tang-mm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // Replaces rtd-address with new-address in links | ||
|
|
||
| const rtd_address = 'canonical-checkbox.readthedocs-hosted.com'; | ||
| const new_address = 'ubuntu.com/docs/checkbox'; | ||
|
|
||
| function escapeRegExp(value) { | ||
| return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | ||
| } | ||
|
|
||
| function overwriteMatchingAnchorUrls(container) { | ||
| if (!container) return; | ||
|
|
||
| const rtd_addressRegex = new RegExp(escapeRegExp(rtd_address), 'g'); | ||
| container.querySelectorAll('a[href], link[href]').forEach((anchor) => { | ||
| anchor.href = anchor.href.replace(rtd_addressRegex, new_address); | ||
| }); | ||
| } | ||
|
|
||
| function patchFlyout() { | ||
| const rtdFlyout = document.querySelector('readthedocs-flyout'); | ||
| if (!rtdFlyout) return false; | ||
|
|
||
| overwriteMatchingAnchorUrls(rtdFlyout); | ||
| overwriteMatchingAnchorUrls(rtdFlyout.shadowRoot); | ||
|
|
||
| rtdFlyout.addEventListener('click', () => { | ||
| overwriteMatchingAnchorUrls(rtdFlyout); | ||
| overwriteMatchingAnchorUrls(rtdFlyout.shadowRoot); | ||
| }); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| function init() { | ||
| overwriteMatchingAnchorUrls(document.querySelector('header')); | ||
|
|
||
| if (patchFlyout()) return; | ||
|
|
||
| const observer = new MutationObserver(() => { | ||
| if (patchFlyout()) { | ||
| observer.disconnect(); | ||
| } | ||
| }); | ||
|
|
||
| observer.observe(document.body, { childList: true, subtree: true }); | ||
| } | ||
|
|
||
| if (document.body) { | ||
| init(); | ||
| } else { | ||
| document.addEventListener('DOMContentLoaded', init); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| <div class="related-pages"> | ||
| {# mod: Per-page navigation #} | ||
| {% if meta %} | ||
| {% if 'sequential_nav' in meta %} | ||
| {% set sequential_nav = meta.sequential_nav %} | ||
| {% endif %} | ||
| {% endif %} | ||
| {# mod: Conditional wrappers to control page navigation buttons #} | ||
| {% if sequential_nav != "none" -%} | ||
| {% if next and (sequential_nav == "next" or sequential_nav == "both") -%} | ||
| <a class="next-page" href="{{ next.link }}"> | ||
| <div class="page-info"> | ||
| <div class="context"> | ||
| <span>{{ _("Next") }}</span> | ||
| </div> | ||
| <div class="title">{{ next.title }}</div> | ||
| </div> | ||
| <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg> | ||
| </a> | ||
| {%- endif %} | ||
| {% if prev and (sequential_nav == "prev" or sequential_nav == "both") -%} | ||
| <a class="prev-page" href="{{ prev.link }}"> | ||
| <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg> | ||
| <div class="page-info"> | ||
| <div class="context"> | ||
| <span>{{ _("Previous") }}</span> | ||
| </div> | ||
| {% if prev.link == pathto(root_doc) %} | ||
| <div class="title">{{ _("Home") }}</div> | ||
| {% else %} | ||
| <div class="title">{{ prev.title }}</div> | ||
| {% endif %} | ||
| </div> | ||
| </a> | ||
| {%- endif %} | ||
| {%- endif %} | ||
| </div> | ||
| <div class="bottom-of-page"> | ||
| <div class="left-details"> | ||
| {%- if show_copyright %} | ||
| <div class="copyright"> | ||
| {%- if hasdoc('copyright') %} | ||
| {% trans path=pathto('copyright'), copyright=copyright|e -%} | ||
| <a href="{{ path }}">© {{ copyright }} {{ author }}</a> | ||
| {%- endtrans %} | ||
| {%- else %} | ||
| {% trans copyright=copyright|e -%} | ||
| © {{ copyright }} {{ author }} | ||
| {%- endtrans %} | ||
| {%- endif %} | ||
| </div> | ||
| {%- endif %} | ||
| {%- if license and license.name -%} | ||
| {%- if license.url -%} | ||
| <div class="license"> | ||
| This page is licensed under <a href="{{ license.url }}">{{ license.name }}</a> | ||
| </div> | ||
| {%- else -%} | ||
| <div class="license"> | ||
| This page is licensed under {{ license.name }} | ||
| </div> | ||
| {%- endif -%} | ||
| {%- endif -%} | ||
|
|
||
| {# mod: removed "Made with" #} | ||
|
|
||
| {%- if last_updated -%} | ||
| <div class="last-updated"> | ||
| {% trans last_updated=last_updated|e -%} | ||
| Last updated on {{ last_updated }} | ||
| {%- endtrans -%} | ||
| </div> | ||
| {%- endif %} | ||
|
|
||
| {%- if show_source and has_source and sourcename %} | ||
| <div class="show-source"> | ||
| <a class="muted-link" href="{{ pathto('_sources/' + sourcename, true)|e }}" | ||
| rel="nofollow">Show source</a> | ||
| </div> | ||
| {%- endif %} | ||
| </div> | ||
| <div> | ||
| {% if has_contributor_listing and display_contributors and pagename and page_source_suffix %} | ||
| {% set contributors = get_contributors_for_file(pagename, page_source_suffix) %} | ||
| {% if contributors %} | ||
| {% if contributors | length > 1 %} | ||
| <a class="display-contributors">Thanks to the {{ contributors |length }} contributors!</a> | ||
| {% else %} | ||
| <a class="display-contributors">Thanks to our contributor!</a> | ||
| {% endif %} | ||
| <div id="overlay"></div> | ||
| <ul class="all-contributors"> | ||
| {% for contributor in contributors %} | ||
| <li> | ||
| <a href="{{ contributor[1] }}" class="contributor">{{ contributor[0] }}</a> | ||
| </li> | ||
| {% endfor %} | ||
| </ul> | ||
| {% endif %} | ||
| {% endif %} | ||
| </div> | ||
| <div class="right-details"><a href="" class="js-revoke-cookie-manager muted-link">Manage your tracker settings</a></div> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| <header id="header" class="p-navigation"> | ||
|
|
||
| <!-- Google Tag Manager --> | ||
| <script> | ||
| (function(w, d, s, l, i) { | ||
| w[l] = w[l] || []; | ||
| w[l].push({ | ||
| 'gtm.start': new Date().getTime(), | ||
| event: 'gtm.js' | ||
| }); | ||
| var f = d.getElementsByTagName(s)[0]; | ||
| var j = d.createElement(s); | ||
| var dl = ''; | ||
| if (l != 'dataLayer') { | ||
| dl = '&l=' + l; | ||
| } | ||
| j.async = true; | ||
| j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; | ||
| f.parentNode.insertBefore(j, f); | ||
| })(window, document, 'script', 'dataLayer', 'GTM-KNX3CJC'); | ||
| </script> | ||
|
|
||
| <div class="p-navigation__nav" role="menubar"> | ||
|
|
||
| <ul class="p-navigation__links" role="menu"> | ||
|
|
||
| <li> | ||
| <a class="p-logo" href="https://{{ product_page }}" aria-current="page"> | ||
| <img src="{{ pathto(product_tag,1) }}" alt="Logo" class="p-logo-image"> | ||
| <div class="p-logo-text p-heading--4">{{ project }} | ||
| </div> | ||
| </a> | ||
|
tang-mm marked this conversation as resolved.
|
||
| </li> | ||
|
|
||
| <li class="nav-ubuntu-com"> | ||
| <a href="https://{{ product_page }}" class="p-navigation__link">{{ product_page }}</a> | ||
| </li> | ||
|
|
||
| <li> | ||
| <a href="#" class="p-navigation__link nav-more-links">More resources</a> | ||
| <ul class="more-links-dropdown"> | ||
|
|
||
| {% if discourse %} | ||
| <li> | ||
| <a href="{{ discourse }}" class="p-navigation__sub-link p-dropdown__link">Discourse</a> | ||
| </li> | ||
| {% endif %} | ||
|
|
||
| {% if mattermost %} | ||
| <li> | ||
| <a href="{{ mattermost }}" class="p-navigation__sub-link p-dropdown__link">Mattermost</a> | ||
| </li> | ||
| {% endif %} | ||
|
|
||
| {% if matrix %} | ||
| <li> | ||
| <a href="{{ matrix }}" class="p-navigation__sub-link p-dropdown__link">Matrix</a> | ||
| </li> | ||
| {% endif %} | ||
|
|
||
| {% if github_url %} | ||
| <li> | ||
| <a href="{{ github_url }}" class="p-navigation__sub-link p-dropdown__link">GitHub</a> | ||
| </li> | ||
| {% endif %} | ||
|
|
||
| </ul> | ||
| </li> | ||
|
|
||
| </ul> | ||
| </div> | ||
| </header> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.