Skip to content

Commit 673531b

Browse files
committed
fix: apply fixes from reviews
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent b602566 commit 673531b

6 files changed

Lines changed: 121 additions & 77 deletions

File tree

.github/workflows/generate-top-index.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
name: Build index.html
1111
runs-on: ubuntu-latest
1212

13+
permissions:
14+
contents: write
15+
1316
steps:
1417
- name: Cache git metadata
1518
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
@@ -28,7 +31,7 @@ jobs:
2831
- name: Get stable branches
2932
id: branch
3033
run: |
31-
branches=$(git ls-remote --heads origin "heads/stable[0-9][0-9]"| awk '{gsub(/^refs\/heads\/stable/, "", $2); print $2}' | sort -n -r | tr '\n' ' ')
34+
branches=$(git ls-remote --heads origin "stable[0-9]*" | awk '{gsub(/^refs\/heads\/stable/, "", $2); print $2}' | sort -n -r | tr '\n' ' ')
3235
echo "branches=$branches" >> $GITHUB_OUTPUT
3336
3437
- name: Setup php
@@ -42,6 +45,7 @@ jobs:
4245
4346
- name: Switch to gh-pages branch
4447
run: |
48+
git fetch origin gh-pages
4549
git checkout gh-pages
4650
git config --local user.email "action@github.com"
4751
git config --local user.name "GitHub Action"

.github/workflows/sphinxbuild.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ jobs:
118118
run: |
119119
current_branch="${GITHUB_REF#refs/heads/}"
120120
121-
# Find the highest numbered stable branch
122-
highest_stable=$(git ls-remote --heads origin 'heads/stable[0-9][0-9]' | sed 's?.*refs/heads/stable??' | sort -n | tail -1)
121+
# Find the highest numbered stable branch from the remote
122+
highest_stable=$(git ls-remote --heads origin 'stable[0-9]*' | sed 's?.*refs/heads/stable??' | sort -n | tail -1)
123123
highest_stable_branch="stable${highest_stable}"
124124
125125
echo "Current branch: $current_branch"
@@ -132,6 +132,8 @@ jobs:
132132
;;
133133
"$highest_stable_branch")
134134
echo "branch_name=stable" >> $GITHUB_OUTPUT
135+
# Also record the numeric version so we can publish to server/<number>/ too
136+
echo "version_name=${highest_stable}" >> $GITHUB_OUTPUT
135137
;;
136138
*)
137139
# Remove stable prefix for current branch
@@ -150,22 +152,33 @@ jobs:
150152
rm -rf server/${{ steps.branch.outputs.branch_name }}
151153
mkdir -p server/${{ steps.branch.outputs.branch_name }}
152154
153-
# Copy all built documentation
155+
# Copy all built documentation into dedicated subdirectories
154156
for artifact in artifacts/*; do
155157
if [ -d "$artifact" ]; then
156-
cp -r "$artifact/" server/${{ steps.branch.outputs.branch_name }}
158+
manual_name="$(basename "$artifact")"
159+
mkdir -p "server/${{ steps.branch.outputs.branch_name }}/$manual_name"
160+
cp -r "$artifact/"* "server/${{ steps.branch.outputs.branch_name }}/$manual_name/"
157161
fi
158162
done
159163
160164
# Move pdf files to the root of the branch_name
161165
mv server/${{ steps.branch.outputs.branch_name }}/*/*.pdf server/${{ steps.branch.outputs.branch_name }}/ || true
162166
167+
# If this is the highest stable branch, also deploy to its versioned folder
168+
if [ -n "${{ steps.branch.outputs.version_name }}" ]; then
169+
rm -rf server/${{ steps.branch.outputs.version_name }}
170+
cp -r server/${{ steps.branch.outputs.branch_name }} server/${{ steps.branch.outputs.version_name }}
171+
fi
172+
163173
# Cleanup
164174
find . -type d -empty -delete
165175
rm -rf artifacts
166176
167177
- name: Add various redirects
168178
run: |
179+
# Fetch source branches so git checkout origin/... works from the gh-pages checkout
180+
git fetch origin ${{ github.event.repository.default_branch }} ${{ github.ref_name }}
181+
169182
# Generate go.php redirect from main branch
170183
git checkout origin/${{ github.event.repository.default_branch }} -- go.php/index.html
171184
mkdir -p server/${{ steps.branch.outputs.branch_name }}/go.php

.github/workflows/update-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3939
with:
4040
fetch-depth: 0 # Fetch full history to access all branches
4141
token: ${{ secrets.WORKFLOW_TOKEN }}

build/build-index.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
// We added this script when we had only 12 and above.
1010
$branches = array_filter($branches, fn($b) => $b >= 12);
1111

12+
if (empty($branches)) {
13+
fwrite(STDERR, "Error: No valid stable branches were provided. Please pass at least one numeric branch >= 12.\n");
14+
exit(1);
15+
}
16+
1217
// Generate current development version section
1318
$sections = [generate_section(($branches[0] + 1), 0)];
1419

@@ -35,4 +40,10 @@
3540
$index
3641
);
3742

43+
$index = str_replace(
44+
'<!-- CURRENT_YEAR -->',
45+
date('Y'),
46+
$index
47+
);
48+
3849
file_put_contents(__DIR__ . '/index.html', $index);

build/index-template.html

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
<!-- Twitter Card data -->
1818
<meta name="twitter:card" content="summary_large_image">
1919
<meta name="twitter:site" content="@nextclouders">
20-
<meta name="twitter:url" content="https://docs.skjnldsv.com/server/">
20+
<meta name="twitter:url" content="https://docs.nextcloud.com">
2121
<meta name="twitter:title" content="Nextcloud Documentation">
2222
<meta name="twitter:description" content="Nextcloud is an open source, self-hosted file share and communication platform. Access &amp; sync your files, contacts, calendars &amp; communicate and collaborate across your devices.">
2323

2424
<!-- Open Graph data -->
2525
<meta property="og:title" content="Nextcloud Documentation" />
2626
<meta property="og:type" content="article" />
27-
<meta property="og:url" content="https://docs.skjnldsv.com/server/" />
27+
<meta property="og:url" content="https://docs.nextcloud.com/" />
2828
<meta property="og:description" content="Nextcloud is an open source, self-hosted file share and communication platform. Access &amp; sync your files, contacts, calendars &amp; communicate and collaborate across your devices. You decide what happens with your data, where it is and who can access it!" />
2929
<meta property="og:site_name" content="Nextcloud" />
3030
<meta property="fb:admins" content="1032807203462807" />
@@ -134,7 +134,7 @@
134134
<li class="nav__item"><a href="https://nextcloud.com/contribute">How to contribute</a></li>
135135
<li class="nav__item"><a href="https://github.com/nextcloud">Code on GitHub</a></li>
136136
<li class="nav__item"><a href="https://github.com/nextcloud/server/issues/new/choose">Report a bug</a></li>
137-
<li class="nav__item"><a href="https://docs.skjnldsv.com/server/stable/developer_manual/">Developer Docs</a></li>
137+
<li class="nav__item"><a href="https://docs.nextcloud.com/server/latest/developer_manual/">Developer Docs</a></li>
138138
<li class="nav__item"><a href="https://nextcloud.com/code-of-conduct">Code of Conduct</a></li>
139139
<li class="nav__item"><a href="https://nextcloud.com/security">Security information</a></li>
140140
</ul>
@@ -156,7 +156,7 @@
156156
<li class="ghost-btn"><a href="https://demo.nextcloud.com/" class="nav__label">Demo</a></li>
157157
<li class="ghost-btn"><a href="https://nextcloud.com/install" class="nav__label">Download</a></li>
158158
<li class="ghost-btn"><a href="https://nextcloud.com/enterprise/buy" class="nav__label">Buy</a></li>
159-
<li class="ghost-btn"><a href="https://nextcloud.com/pricing#faq" class="nav__label">FAQ</a></li>
159+
<li class="ghost-btn"><a href="https://nextcloud.com/faq" class="nav__label">FAQ</a></li>
160160
</ul>
161161
</div>
162162
</div>
@@ -190,9 +190,9 @@ <h1>Nextcloud Desktop Client<a class="headerlink" href="#desktop" title="Permali
190190
Find documentation for the desktop client below.</p>
191191

192192
<ul class="simple">
193-
<li><a class="reference external" href="https://docs.skjnldsv.com/server/latest/user_manual/en/desktop/index.html">User Manual</a>
194-
<li><a class="reference external" href="https://docs.skjnldsv.com/server/latest/admin_manual/desktop/index.html">Administration Manual</a>
195-
<li><a class="reference external" href="https://docs.skjnldsv.com/server/latest/developer_manual/desktop/index.html">Developer Manual</a>
193+
<li><a class="reference external" href="https://docs.nextcloud.com/server/latest/user_manual/en/desktop/index.html">User Manual</a>
194+
<li><a class="reference external" href="https://docs.nextcloud.com/server/latest/admin_manual/desktop/index.html">Administration Manual</a>
195+
<li><a class="reference external" href="https://docs.nextcloud.com/server/latest/developer_manual/desktop/index.html">Developer Manual</a>
196196
</ul>
197197
</div> <!-- desktop -->
198198

@@ -229,69 +229,74 @@ <h1>Reporting Documentation Bugs &amp; How to Contribute<a class="headerlink" hr
229229
</div><!-- container -->
230230

231231
<footer class="content-info page-footer" role="contentinfo">
232-
<div class="container">
232+
<div class="bootstrap-container">
233233
<div class="row">
234-
<div class="col-sm-3">
235-
<div class="footer-nav">
236-
<h1>About Nextcloud</h1>
237-
<ul>
238-
<li><a class="reference external" href="https://nextcloud.com/about">About us</a></li>
239-
<li><a class="reference external" href="https://nextcloud.com/events">Events</a></li>
240-
<li><a class="reference external" href="https://nextcloud.com/jobs">Jobs</a></li>
241-
<li><a class="reference external" href="https://nextcloud.com/community/code-of-conduct/">Code of Conduct</a></li>
242-
<li><a class="reference external" href="https://nextcloud.com/privacy">Privacy</a></li>
243-
<li><a class="reference external" href="https://nextcloud.com/impressum">Legal notice</a></li>
244-
</ul>
234+
<div class="col-sm-4 offering">
235+
<div>
236+
<img class="logo" src="./static/img/logo.svg" alt="Nextcloud logo">
245237
</div>
238+
<p>Nextcloud offers a modern, on premise content collaboration platform with real-time document editing, video chat &amp; groupware on mobile, desktop and web.</p>
246239
</div>
247-
<div class="col-sm-3">
248-
<div class="footer-nav">
249-
<h1>Resources</h1>
250-
<ul>
251-
<li><a class="reference external" href="https://nextcloud.com/search/">Search our website</a></li>
252-
<li><a class="reference external" href="https://nextcloud.com/install">Download</a></li>
253-
<li><a class="reference external" href="https://apps.nextcloud.com">App Store</a></li>
254-
<li><a class="reference external" href="https://docs.skjnldsv.com/server/latest/admin_manual/">Admin manual</a></li>
255-
<li><a class="reference external" href="https://docs.skjnldsv.com/server/latest/user_manual/en/">User manual</a></li>
256-
<li><a class="reference external" href="https://nextcloud.com/developer/">Developer program</a></li>
257-
<li><a class="reference external" href="https://nextcloud.com/security">Security</a></li>
258-
<li><a class="reference external" href="https://github.com/nextcloud">Code on GitHub</a></li>
259-
<li><a class="reference external" href="https://nextcloud.com/compare/">Compare</a></li>
260-
</ul>
261-
</div>
240+
<div class="col-sm-2">
241+
<h1>About Nextcloud</h1>
242+
<ul>
243+
<li><a href="https://nextcloud.com/about/">About us</a></li>
244+
<li><a href="https://nextcloud.com/jobs/">Jobs</a></li>
245+
<li><a href="https://nextcloud.com/partners/">Partners</a></li>
246+
<li><a href="https://nextcloud.com/contribute/code-of-conduct/">Code of Conduct</a></li>
247+
<li><a href="https://nextcloud.com/privacy/">Privacy</a></li>
248+
<li><a href="https://nextcloud.com/press/">Press</a></li>
249+
<li><a href="https://nextcloud.com/impressum/">Legal notice</a></li>
250+
<li><a href="https://nextcloud.com/trademarks/">Trademarks</a></li>
251+
<li><a href="https://nextcloud.com/brand/">Brand guidelines</a></li>
252+
<li><a href="https://nextcloud.com/features/">Features</a></li>
253+
<li><a href="https://nextcloud.com/human-rights-policy/">Human Rights Policy</a></li>
254+
<li><a href="https://nextcloud.com/code-of-ethics/">Code of Ethics</a></li>
255+
<li><a href="https://nextcloud.com/events/">Events</a></li>
256+
</ul>
262257
</div>
263-
<div class="col-sm-3">
264-
<div class="footer-nav">
265-
<h1>Interact</h1>
266-
<ul>
267-
<li><a class="reference external" href="https://nextcloud.com/support">Support</a></li>
268-
<li><a class="reference external" href="https://help.nextcloud.com/categories">Forums</a></li>
269-
<li><a class="reference external" href="https://try.nextcloud.com">Demo</a></li>
270-
<li><a class="reference external" href="https://nextcloud.com/contact">Contact us</a></li>
271-
<li><a class="reference external" href="https://nextcloud.com/press">Press center</a></li>
272-
<li><a class="reference external" href="https://github.com/nextcloud/server/issues">Bug Tracker</a></li>
273-
</ul>
274-
</div>
258+
<div class="col-sm-2">
259+
<h1>Resources</h1>
260+
<ul>
261+
<li><a href="https://nextcloud.com/install">Download</a></li>
262+
<li><a href="https://apps.nextcloud.com">App Store</a></li>
263+
<li><a href="https://docs.nextcloud.com/server/latest/admin_manual/">Admin manual</a></li>
264+
<li><a href="https://docs.nextcloud.com/server/latest/user_manual/">User manual</a></li>
265+
<li><a href="https://nextcloud.com/security/">Security</a></li>
266+
<li><a href="https://nextcloud.com/developer/">Developer information</a></li>
267+
<li><a href="https://github.com/nextcloud">Code on GitHub</a></li>
268+
<li><a href="https://nextcloud.com/compare">Compare with others</a></li>
269+
<li><a href="https://portal.nextcloud.com/search?q=Introduction">Search</a></li>
270+
<li><a href="https://status.nextcloud.com/">Status</a></li>
271+
</ul>
275272
</div>
276-
<div class="col-sm-3">
277-
<div class="footer-nav">
278-
<h1>Follow us</h1>
279-
<ul>
280-
<li><a class="reference external" href="https://www.facebook.com/Nextcloud-1032807203462807/">Facebook</a></li>
281-
<li><a class="reference external" href="https://instagram.com/nextclouders">Instagram</a></li>
282-
<li><a class="reference external" href="https://www.linkedin.com/company/10827569/">LinkedIn</a></li>
283-
<li><a class="reference external" href="https://youtube.com/nextcloud">YouTube</a></li>
284-
<li><a class="reference external" href="https://twitter.com/nextclouders">Twitter</a></li>
285-
<li><a class="reference external" href="https://mastodon.xyz/@nextcloud">Mastodon</a></li>
286-
<li><a class="reference external" href="https://nextcloud.com/podcast/">Podcast</a></li>
287-
<li><a class="reference external" href="https://nextcloud.com/blogfeed">RSS Feed</a></li>
288-
</ul>
289-
</div>
273+
<div class="col-sm-2">
274+
<h1>Interact</h1>
275+
<ul>
276+
<li><a href="https://nextcloud.com/support/">Support</a></li>
277+
<li><a href="https://help.nextcloud.com/categories">Forums</a></li>
278+
<li><a href="https://nextcloud.com/instant-trial/">Demo</a></li>
279+
<li><a href="https://nextcloud.com/contact/">Contact us</a></li>
280+
<li><a href="https://github.com/nextcloud">Bug Tracker</a></li>
281+
</ul>
282+
</div>
283+
<div class="col-sm-2">
284+
<h1>Follow us</h1>
285+
<ul>
286+
<li><a href="https://nextcloud.com/blog/">Blog</a></li>
287+
<li><a href="https://www.facebook.com/Nextclouders/">Facebook</a></li>
288+
<li><a href="https://x.com/nextclouders">X</a></li>
289+
<li><a href="https://instagram.com/nextclouders">Instagram</a></li>
290+
<li><a href="https://www.linkedin.com/company/10827569/">LinkedIn</a></li>
291+
<li><a href="https://youtube.com/nextcloud">YouTube</a></li>
292+
<li><a href="https://mastodon.xyz/@nextcloud">Mastodon</a></li>
293+
<li><a href="https://nextcloud.com/feed/">Feed</a></li>
294+
</ul>
290295
</div>
291296
</div>
292297
<div class="row">
293-
<div class="col-sm-12 text-center">
294-
<p>&copy; 2021 Nextcloud GmbH</p>
298+
<div class="col-sm-10 col-sm-offset-1">
299+
<p class="copyright">&copy; <!-- CURRENT_YEAR --> Nextcloud GmbH</p>
295300
</div>
296301
</div>
297302
</div><!-- container -->

go.php/index.html

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ <h1>Redirecting to documentation...</h1>
6464
'admin-warnings': '/admin_manual/configuration_server/security_setup_warnings.html',
6565
'admin-windows-compatible-filenames': '/admin_manual/configuration_files/windows_compatible_filenames.html',
6666
'admin-workflowengine': '/admin_manual/file_workflows/index.html',
67+
'admin-android-deep-link-handling': '/admin_manual/configuration_server/android_deep_link_handling.html',
6768

6869
'developer-manual': '/developer_manual',
6970
'developer-backports': '/developer_manual/getting_started/development_process.html#bugfixes',
@@ -98,20 +99,24 @@ <h1>Redirecting to documentation...</h1>
9899
'zh_TW', 'ar', 'ca', 'da', 'el', 'eo', 'eu', 'fr', 'gl', 'hu', 'id', 'ja_JP',
99100
'mn', 'nl', 'pl', 'pt_PT', 'ru', 'sk_SK', 'sq', 'sv', 'th', 'uk', 'vi', 'zh_HK',
100101
]
102+
// Build a lowercase lookup map to canonical form for case-insensitive matching
103+
const supportedLower = supportedLanguages.map(l => l.toLowerCase())
101104

102105
for (const lang of languages) {
103106
const fullLang = lang.replace('-', '_'); // Normalize e.g. en-US → en_US
104107
const lowerFullLang = fullLang.toLowerCase()
105108

106-
// Try full language code (e.g., en_US)
107-
if (supportedLanguages.includes(lowerFullLang)) {
108-
return lowerFullLang
109+
// Try full language code (e.g., en_US) — return canonical directory name
110+
const fullIdx = supportedLower.indexOf(lowerFullLang)
111+
if (fullIdx !== -1) {
112+
return supportedLanguages[fullIdx]
109113
}
110114

111-
// Try base language code (e.g., en)
115+
// Try base language code (e.g., en) — return canonical directory name
112116
const baseLang = lowerFullLang.split('_')[0]
113-
if (supportedLanguages.includes(baseLang)) {
114-
return baseLang
117+
const baseIdx = supportedLower.indexOf(baseLang)
118+
if (baseIdx !== -1) {
119+
return supportedLanguages[baseIdx]
115120
}
116121
}
117122

@@ -122,15 +127,21 @@ <h1>Redirecting to documentation...</h1>
122127
function performRedirect() {
123128
const from = getQueryParam('to')
124129
const currentLocation = window.location
125-
const basePath = currentLocation.pathname.replace('/go.php/', '').replace('/go.php', '')
130+
const basePath = currentLocation.pathname.replace(/\/go\.php(\/.*)?$/, '')
126131

127132
let subPath
128133

129134
if (mapping[from]) {
130135
subPath = mapping[from]
131136
} else {
132-
// If no mapping found, redirect to the parent directory
133-
subPath = '/'
137+
// Prefix-based fallback to preserve legacy PHP redirect behavior
138+
if (from && from.startsWith('admin-')) {
139+
subPath = '/admin_manual'
140+
} else if (from && from.startsWith('developer-')) {
141+
subPath = '/developer_manual'
142+
} else {
143+
subPath = '/user_manual'
144+
}
134145
}
135146

136147
// Handle user manual language detection

0 commit comments

Comments
 (0)