瀏覽代碼

improve posts

ruki 4 天之前
父節點
當前提交
68137156fa

+ 1 - 1
docs/.vitepress/theme/components/VPCarbonAds.vue

@@ -37,7 +37,7 @@ if (carbonOptions) {
   onMounted(() => {
     // Only initialize if the container is visible to avoid ID conflicts
     // with other instances (e.g. sidebar vs bottom)
-    if (container.value && container.value.offsetParent !== null) {
+    if (container.value) {
       init()
     }
   })

+ 2 - 2
docs/.vitepress/theme/components/VPSidebar.vue

@@ -6,7 +6,7 @@ import { useLayout } from 'vitepress/dist/client/theme-default/composables/layou
 import VPSidebarGroup from 'vitepress/dist/client/theme-default/components/VPSidebarGroup.vue'
 
 import { useData } from 'vitepress/dist/client/theme-default/composables/data'
-import VPDocAsideCarbonAds from 'vitepress/dist/client/theme-default/components/VPDocAsideCarbonAds.vue'
+import VPCarbonAds from './VPCarbonAds.vue'
 const { theme, page } = useData()
 
 const { sidebarGroups, hasSidebar } = useLayout()
@@ -81,7 +81,7 @@ watch(
     >
 
       <!-- Show carbonAds at the top of left sidebar -->
-      <VPDocAsideCarbonAds 
+      <VPCarbonAds 
         v-if="theme.carbonAds" 
         :carbon-ads="theme.carbonAds" 
       />

+ 1 - 1
docs/.vitepress/theme/index.ts

@@ -36,7 +36,7 @@ export default {
              page.value.filePath.includes('/zh/')
     })
     const isPost = computed(() => {
-      return page.value.filePath.includes('posts/')
+      return page.value.filePath.includes('posts/') || page.value.filePath.includes('blog/')
     })
 
     if (typeof window !== 'undefined') {

+ 20 - 1
docs/config.ts

@@ -18,6 +18,20 @@ export default defineAdditionalConfig({
       '/api/description/': { base: '/api/description/', items: descriptionApiSidebar() },
       '/api/scripts/': { base: '/api/scripts/', items: scriptsApiSidebar() },
       '/examples/': { base: '/examples/', items: examplesSidebar() },
+      '/blog/': [
+        {
+          text: 'Blog',
+          items: [
+            { text: 'Return to Home', link: '/' }
+          ]
+        },
+        {
+          text: 'Next Steps',
+          items: [
+            { text: 'Documentation', link: '/guide/introduction' }
+          ]
+        }
+      ],
       ...postsSidebar(),
     },
 
@@ -83,7 +97,12 @@ function postsSidebar(): Record<string, DefaultTheme.SidebarItem[]> {
     if (prev) {
       items.push({ text: 'Next Post', link: prev.url })
     }
-    items.push({ text: 'Return to Blog', link: '/blog/' })
+    items.push({ 
+      text: 'Next Steps',
+      items: [
+        { text: 'Documentation', link: '/guide/introduction' }
+      ]
+    })
     
     sidebar[post.url + '/'] = items
     sidebar[post.url + '.html'] = items

+ 20 - 1
docs/zh/config.ts

@@ -20,6 +20,20 @@ export default defineAdditionalConfig({
       '/zh/api/description/': { base: '/zh/api/description/', items: descriptionApiSidebar() },
       '/zh/api/scripts/': { base: '/zh/api/scripts/', items: scriptsApiSidebar() },
       '/zh/examples/': { base: '/zh/examples/', items: examplesSidebar() },
+      '/zh/blog/': [
+        {
+          text: '博客',
+          items: [
+            { text: '返回首页', link: '/zh/' }
+          ]
+        },
+        {
+          text: '下一步',
+          items: [
+            { text: '文档', link: '/zh/guide/introduction' }
+          ]
+        }
+      ],
       ...postsSidebar(),
     },
 
@@ -164,7 +178,12 @@ function postsSidebar(): Record<string, DefaultTheme.SidebarItem[]> {
     if (prev) {
       items.push({ text: '下一篇', link: prev.url })
     }
-    items.push({ text: '返回博客', link: '/zh/blog/' })
+    items.push({ 
+      text: '下一步',
+      items: [
+        { text: '文档', link: '/zh/guide/introduction' }
+      ]
+    })
     
     sidebar[post.url + '/'] = items
     sidebar[post.url + '.html'] = items