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 10
10
import MobileSubMenu from ' ./MobileSubMenu.svelte' ;
11
11
import type { NavigationLink } from ' ../types' ;
12
12
import ModalOverlay from ' ../components/ModalOverlay.svelte' ;
13
+ import { github_link } from ' ./Nav.svelte' ;
13
14
14
15
interface Props {
15
16
links: NavigationLink [];
150
151
<li ><a href =" https://bsky.app/profile/svelte.dev" >Bluesky</a ></li >
151
152
<li >
152
153
<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
158
155
>
159
156
</li >
160
157
</ul >
Original file line number Diff line number Diff line change 2
2
Top navigation bar for the application. It provides a slot for the left side, the right side, and the center.
3
3
-->
4
4
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
+
5
18
<script lang =" ts" >
6
19
import { overlay_open , on_this_page_open } from ' ../stores' ;
7
20
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
133
146
<span data-icon =" bluesky" ></span >
134
147
</a >
135
148
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" >
144
150
<span data-icon =" github" ></span >
145
151
</a >
146
152
</div >
You can’t perform that action at this time.
0 commit comments