File tree Expand file tree Collapse file tree 2 files changed +16
-13
lines changed
packages/site-kit/src/lib/nav Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 1010 import MobileSubMenu from ' ./MobileSubMenu.svelte' ;
1111 import type { NavigationLink } from ' ../types' ;
1212 import ModalOverlay from ' ../components/ModalOverlay.svelte' ;
13+ import { github_link } from ' ./Nav.svelte' ;
1314
1415 interface Props {
1516 links: NavigationLink [];
150151 <li ><a href =" https://bsky.app/profile/svelte.dev" >Bluesky</a ></li >
151152 <li >
152153 <a
153- href ="https://github.com/sveltejs/ {page .url .pathname .startsWith (' /docs/kit' )
154- ? ' kit'
155- : page .url .pathname .startsWith (' /docs/cli' )
156- ? ' cli'
157- : ' svelte' }" >GitHub</a
154+ href ={github_link (page )}>GitHub</a
158155 >
159156 </li >
160157 </ul >
Original file line number Diff line number Diff line change 22Top navigation bar for the application. It provides a slot for the left side, the right side, and the center.
33-->
44
5+ <script lang =" ts" module >
6+ import type { Page } from ' @sveltejs/kit' ;
7+ export function github_link(page : Page ) {
8+ if (page .url .pathname .startsWith (' /tutorial' )) {
9+ return ` https://github.com/sveltejs/${page .params .slug .split (' /' )[0 ]} ` ;
10+ }
11+ if (page .url .pathname .startsWith (' /docs' )) {
12+ return ` https://github.com/sveltejs/${page .params .topic } ` ;
13+ }
14+ return ' https://github.com/sveltejs/svelte' ;
15+ }
16+ </script >
17+
518<script lang =" ts" >
619 import { overlay_open , on_this_page_open } from ' ../stores' ;
720 import { search } from ' ../state/search.svelte' ;
@@ -133,14 +146,7 @@ Top navigation bar for the application. It provides a slot for the left side, th
133146 <span data-icon =" bluesky" ></span >
134147 </a >
135148
136- <a
137- href ="https://github.com/sveltejs/ {page .url .pathname .startsWith (' /docs/kit' )
138- ? ' kit'
139- : page .url .pathname .startsWith (' /docs/cli' )
140- ? ' cli'
141- : ' svelte' }"
142- aria-label =" GitHub Repo"
143- >
149+ <a href ={github_link (page )} aria-label =" GitHub Repo" >
144150 <span data-icon =" github" ></span >
145151 </a >
146152 </div >
You can’t perform that action at this time.
0 commit comments