Skip to content

Commit 249dff7

Browse files
committed
Add version warning and canonical URLs to old versions
1 parent c7d7189 commit 249dff7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

docs/src/layouts/BaseLayout.astro

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let nextPage = allLinks[linkIndex + 1]
4646
let section = packageNavigation.links?.find((item) => item.slug === currentSection) ?? null;
4747
4848
pageTitle = pageTitle ?? buildTitle(title, packageNavigation);
49-
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
49+
const canonicalURL = ((currentVersion !== '4.x') && (currentVersion !== '3.x')) ? new URL('docs/3.x', Astro.site) : new URL(Astro.url.pathname, Astro.site);
5050
---
5151

5252
<!DOCTYPE html>
@@ -172,8 +172,18 @@ const canonicalURL = new URL(Astro.url.pathname, Astro.site);
172172
</div>
173173
<div class="min-w-0 max-w-2xl flex-auto px-4 py-16 lg:max-w-none lg:pr-0 lg:pl-8 xl:pl-16 xl:pr-10">
174174
{(currentVersion === '4.x') && (
175-
<Aside variant="info">
176-
Filament v4 is currently in beta and is not stable. Please report any issues you encounter on <a href="https://github.com/filamentphp/filament/issues/new" target="_blank">GitHub</a>.
175+
<Aside variant="warning">
176+
<p><span class="font-medium">You are currently viewing the documentation for Filament 4.x</span>, which is currently in beta and is not stable. Please report any issues you encounter on <a href="https://github.com/filamentphp/filament/issues/new" target="_blank" class="font-medium underline">GitHub</a>.</p>
177+
178+
<p class="pt-3">Looking for the current stable version? Visit the <a href="/docs/3.x" class="font-medium underline">3.x documentation</a>.</p>
179+
</Aside>
180+
)}
181+
182+
{(currentVersion !== '4.x') && (currentVersion !== '3.x') && (
183+
<Aside variant="warning">
184+
<p><span class="font-medium">You are currently viewing the documentation for Filament {currentVersion}</span>, which is a previous version of Filament.</p>
185+
186+
<p class="pt-3">Looking for the current stable version? Visit the <a href="/docs/3.x" class="font-medium underline">3.x documentation</a>.</p>
177187
</Aside>
178188
)}
179189

0 commit comments

Comments
 (0)