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
5 changes: 3 additions & 2 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[book]
title = "Fugue-Evo Documentation"
title = "Fugue Evo Docs"
authors = ["Fugue-Evo Contributors"]
language = "en"
src = "src"
Expand All @@ -14,8 +14,9 @@ preferred-dark-theme = "navy"
git-repository-url = "https://github.com/alexnodeland/fugue-evo"
edit-url-template = "https://github.com/alexnodeland/fugue-evo/edit/main/docs/{path}"
site-url = "https://evo.fugue.run/"
additional-css = ["fugue-viz.css"]
additional-css = ["fugue-theme.css", "fugue-viz.css"]
additional-js = [
"fugue-brand.js",
"fugue-viz.js",
"fugue-evo-wasm-loader.js",
"viz/landscape.js",
Expand Down
49 changes: 49 additions & 0 deletions docs/fugue-brand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* fugue-brand.js — shared between fugue and fugue-evo (keep byte-identical).
*
* Injects a sibling-site link into the menu bar so fugue.run and
* evo.fugue.run point at each other. Which site we're on is detected by
* hostname; local previews can force it with
* <html data-fugue-site="fugue"|"evo">. */
(function () {
'use strict';

function siblingFor(site) {
return site === 'evo'
? { label: 'Fugue', href: 'https://fugue.run', title: 'Fugue — probabilistic programming for Rust' }
: { label: 'Evo', href: 'https://evo.fugue.run', title: 'Fugue Evo — evolutionary computation for Rust' };
}

function detectSite() {
var forced = document.documentElement.getAttribute('data-fugue-site');
if (forced === 'fugue' || forced === 'evo') return forced;
if (window.location.hostname.indexOf('evo.') === 0) return 'evo';
// Local preview fallback: the evo book titles itself "Fugue-Evo …".
if (/evo/i.test(document.title)) return 'evo';
return 'fugue';
}

function inject() {
var buttons = document.querySelector('#menu-bar .right-buttons');
if (!buttons || buttons.querySelector('.fugue-brand-link')) return;
var sib = siblingFor(detectSite());
var a = document.createElement('a');
a.className = 'fugue-brand-link';
a.href = sib.href;
a.title = sib.title;
a.setAttribute('aria-label', sib.title);
var label = document.createElement('span');
label.textContent = sib.label;
var arrow = document.createElement('span');
arrow.className = 'fugue-brand-arrow';
arrow.textContent = '↗';
a.appendChild(label);
a.appendChild(arrow);
buttons.insertBefore(a, buttons.firstChild);
}

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', inject);
} else {
inject();
}
})();
Loading
Loading