Skip to content

Commit 39560ec

Browse files
fix build
1 parent e561dfc commit 39560ec

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

website/.vitepress/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default defineConfig({
4545
text: 'Resources',
4646
items: [
4747
{ text: 'FAQ', link: '/advanced/faq.html' },
48-
{ text: 'Rule Examples', link: '/catalog/' },
48+
{ text: 'Rule Examples', link: '/catalog' },
4949
{ text: 'Custom Language', link: '/advanced/custom-language.html' },
5050
{ text: 'Contributing', link: '/contributing/how-to.html' },
5151
{ text: 'Blog', link: '/blog.html' },
@@ -117,7 +117,7 @@ export default defineConfig({
117117
},
118118
{
119119
text: 'Examples',
120-
link: '/catalog/',
120+
link: '/catalog',
121121
items: [
122122
{ text: 'C', link: '/catalog/c/'},
123123
{ text: 'C++', link: '/catalog/cpp/'},

website/blog/stars-8000.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ The ast-grep website isn't just a static page; it's your interactive command cen
9696

9797
### Interactive Example Catalog: Learn by Doing!
9898

99-
The [example catalog](/catalog) has received a major upgrade, transforming it into an interactive learning environment:
99+
The [example catalog](https://ast-grep.github.io/catalog) has received a major upgrade, transforming it into an interactive learning environment:
100100

101101
**Interactive Rule Exploration:** Dive deep into rules with interactive features like Rule Display & Extraction, MetaVar Panel, Matched Labeling, Pattern Debugger, Selector Explorer, and Pattern Configuration & Icons. Dissect rules, understand their components, and visualize how they work – all in your browser!
102102

website/src/catalog/index.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ import RuleList from './RuleList.vue'
55
import type { Filter } from './data';
66
import { serialize, deserialize } from './data';
77
8+
// for SSR
9+
const loc = typeof location !== 'undefined' ? location : null
10+
const his = typeof history !== 'undefined' ? history : null
11+
812
const filter = ref<Filter>(deserialize(
9-
location.hash.slice(1) || ''
13+
loc?.hash.slice(1) || ''
1014
))
1115
1216
watch(filter, (value) => {
1317
const hash = serialize(value)
14-
history.replaceState({}, '', hash ? `#${hash}` : '/catalog')
18+
his?.replaceState({}, '', hash ? `#${hash}` : '/catalog')
1519
}, {
1620
deep: true,
1721
immediate: true,

0 commit comments

Comments
 (0)