File tree Expand file tree Collapse file tree 3 files changed +74
-0
lines changed
Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ return [
4+
5+ /*
6+ |--------------------------------------------------------------------------
7+ | Documentation Latest Versions
8+ |--------------------------------------------------------------------------
9+ |
10+ | This configuration defines the latest version for each documentation
11+ | platform. When a user views an older version, they will see a notice
12+ | prompting them to view the latest version.
13+ |
14+ */
15+
16+ 'latest_versions ' => [
17+ 'desktop ' => 2 ,
18+ 'mobile ' => 2 ,
19+ ],
20+
21+ ];
Original file line number Diff line number Diff line change 1+ @props ([' platform' , ' version' , ' page' ] )
2+
3+ @php
4+ $latestVersion = config (" docs.latest_versions.{$platform }" );
5+ $isOldVersion = $latestVersion && (int ) $version < (int ) $latestVersion ;
6+
7+ if ($isOldVersion ) {
8+ $latestPagePath = resource_path (" views/docs/{$platform }/{$latestVersion }/{$page }.md" );
9+ $targetPage = file_exists ($latestPagePath ) ? $page : ' getting-started/introduction' ;
10+
11+ $latestUrl = route (' docs.show' , [
12+ ' platform' => $platform ,
13+ ' version' => $latestVersion ,
14+ ' page' => $targetPage ,
15+ ]);
16+ }
17+ @endphp
18+
19+ @if ($isOldVersion )
20+ <div
21+ class =" mb-6 flex items-center gap-3 rounded-xl bg-amber-50 p-4 text-amber-800 ring-1 ring-amber-200 dark:bg-amber-950/50 dark:text-amber-200 dark:ring-amber-800/50"
22+ role =" alert"
23+ >
24+ <svg
25+ class =" size-5 shrink-0"
26+ xmlns =" http://www.w3.org/2000/svg"
27+ viewBox =" 0 0 20 20"
28+ fill =" currentColor"
29+ aria-hidden =" true"
30+ >
31+ <path
32+ fill-rule =" evenodd"
33+ d =" M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z"
34+ clip-rule =" evenodd"
35+ />
36+ </svg >
37+ <p class =" text-sm" >
38+ You're viewing an older version of this documentation.
39+ <a
40+ href =" {{ $latestUrl } }"
41+ class =" font-medium underline underline-offset-2 hover:text-amber-900 dark:hover:text-amber-100"
42+ >
43+ View the latest version ({{ $latestVersion } } .x)
44+ </a >
45+ </p >
46+ </div >
47+ @endif
Original file line number Diff line number Diff line change 2020 <x-docs .toc-and-sponsors :tableOfContents =" $tableOfContents" />
2121 </x-slot >
2222
23+ <x-docs .old-version-notice
24+ :platform =" $platform"
25+ :version =" $version"
26+ :page =" request()->route('page')"
27+ />
28+
2329 <h1 class =" text-4xl font-semibold" >
2430 {{ $title } }
2531 </h1 >
You can’t perform that action at this time.
0 commit comments