Skip to content
Closed
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
11 changes: 6 additions & 5 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'v*'

env:
CURRENT_MAJOR_VERSION: "4.0"
CURRENT_MAJOR_VERSION: "3.0"

jobs:
deploy:
Expand Down Expand Up @@ -42,22 +42,23 @@ jobs:

if [ "$BRANCH_NAME" == "main" ]; then
echo "Deploying MAIN as Version ${{ env.CURRENT_MAJOR_VERSION }} (Latest)"
uv run mike deploy --deploy-prefix package -b deploy --rebase ${{ env.CURRENT_MAJOR_VERSION }} latest --update-aliases --push
uv run mike deploy --deploy-prefix package -b deploy ${{ env.CURRENT_MAJOR_VERSION }} latest --update-aliases --push
uv run mike set-default latest --push --deploy-prefix package -b deploy
else
# Extracts version from branch name (e.g., v3.0 -> 3.0)
VERSION=$(echo $BRANCH_NAME | sed 's/^v//')
echo "Deploying LEGACY Version: $VERSION"
uv run mike deploy --deploy-prefix package -b deploy --rebase $VERSION --push
uv run mike deploy --deploy-prefix package -b deploy $VERSION --push
fi

- name: Switch Workspace to HTML Branch
run: git checkout gh-pages
run: git checkout deploy

- name: Deploy Entire Collection to Server
uses: Burnett01/rsync-deployments@v8
with:
switches: -avzr --delete
path: ./
path: ./package/
remote_path: ${{ secrets.SERVER_PATH }}
remote_host: ${{ secrets.SERVER_HOST }}
remote_user: ${{ secrets.SERVER_USER }}
Expand Down
39 changes: 39 additions & 0 deletions docs/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,43 @@ article table tbody tr td {
.badge.version-badge .value {
background-color: #fddca1;
color: black;
}
/* Light Mode (Default) */
#version-selector {
background-color: #f6f8fa;
color: #24292f;
border: 1px solid #d0d7de;
border-radius: 6px;
padding: 4px 24px 4px 8px;
font-size: 12px;
font-weight: 600;
cursor: pointer;
appearance: none;
background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2324292f'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 4px center;
background-size: 16px;
transition: background-color 0.2s, border-color 0.2s;
}

#version-selector:hover {
background-color: #f3f4f6;
border-color: #afb8c1;
}

/* Dark Mode (When html has .dark class) */
html.dark #version-selector {
background-color: #24292f;
color: #ffffff;
border-color: #444c56;
background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

html.dark #version-selector:hover {
background-color: #2c333a;
border-color: #768390;
}

article .codehilite {
overflow: scroll;
}
52 changes: 52 additions & 0 deletions docs/assets/js/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
document.addEventListener("DOMContentLoaded", function() {
const path = window.location.pathname;
const match = path.match(/(.*\/)(?:v?\d+\.\d+|latest)\//);
const base_path = match ? match[1] : path.substring(0, path.lastIndexOf('/') + 1);
const json_url = `${base_path}versions.json`;
const stargazers_element = document.querySelector('header div div:nth-child(3) a');

if (!stargazers_element) {
console.warn("Could not find the stargazers element to attach the version selector.");
return;
}
fetch(json_url)
.then(response => response.json())
.then(data => {
const container = document.createElement("div");
container.style.display = "flex";
container.style.alignItems = "center";
container.style.marginLeft = "12px"; // Space between stars and version

// 2. Create the select element
const select = document.createElement("select");
select.id = "version-selector";
select.style.padding = "4px 8px";
select.style.border = "1px solid #444";
select.style.borderRadius = "6px";
select.style.fontSize = "12px";
select.style.fontWeight = "600";
select.onchange = function() { window.location.href = this.value; };

// 3. Populate options
const currentPath = window.location.pathname;
data.forEach(v => {
const opt = document.createElement("option");
const isLatest = v.aliases.includes("latest");

// If it's the latest, point to the /latest/ alias instead of the version folder
opt.value = isLatest ? `${base_path}/latest/` : `${base_path}/${v.version}/`;

opt.textContent = isLatest ? `${v.title} (latest)` : v.title;

if (currentPath.includes(`/${v.version}/`) || (isLatest && currentPath.includes('/latest/'))) {
opt.selected = true;
}
select.appendChild(opt);
});

container.appendChild(select);

stargazers_element.insertAdjacentElement('afterend', container);
})
.catch(error => console.error("Error loading versions:", error));
});
9 changes: 8 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
site_name: Reitti Documentation
site_url: https://www.dedicatedcode.com/projects/reitti/
repo_url: https://github.com/dedicatedcode/reitti
site_author: Daniel Graf
edit_url: https://github.com/dedicatedcode/reitti-documentation/edit/main/docs/

theme:
name: shadcn
Expand All @@ -11,6 +13,7 @@ theme:
dark: github-dark
topbar_sections: false
show_datetime: true
custom_dir: theme/overrides
plugins:
- mkdocs-nav-weight
- badges
Expand All @@ -21,6 +24,10 @@ plugins:
'configurations/reitti-integration.md': 'integrations/reitti.md'
markdown_extensions:
- codehilite

extra:
version:
provider: mike
extra_javascript:
- assets/js/scripts.js
extra_css:
- assets/css/styles.css
Empty file.
16 changes: 16 additions & 0 deletions theme/overrides/templates/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<footer view-transition-name="footer"
class="group-has-[.section-soft]/body:bg-surface/40 3xl:fixed:bg-transparent dark:bg-transparent">
<div class="container-wrapper px-4 xl:px-6">
<div class="flex h-(--footer-height) items-center justify-between">
<div class="text-muted-foreground w-full text-center text-xs leading-loose sm:text-sm">
{% if config.site_author %}
Built by {{ config.site_author | parse_author}} &mdash;
{% endif %}
<a href="https://github.com/asiffer/mkdocs-shadcn">shadcn theme</a> provided by
<a href="https://github.com/asiffer">@asiffer</a>
&mdash;
<a href="{{ config.edit_url }}/{{ page.file.edit_uri }}">edit this page on github</a>
</div>
</div>
</div>
</footer>
2 changes: 1 addition & 1 deletion uv.lock

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