Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
rishi-raj-jain committed Oct 8, 2024
1 parent 9ed753e commit f3385c7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
9 changes: 5 additions & 4 deletions src/pages/blog/[slug].astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
import Layout from '@/layouts/Layout.astro'
import { useRuntimeConfig } from '@/config/app'
import VueBlogSlug from '@/vue-pages/blog/[slug].vue'
import Layout from '@/layouts/Layout.astro'
import { defaultLocale, type Locales } from '@/services/locale'
import VueBlogSlug from '@/vue-pages/blog/[slug].vue'
import type { GetStaticPaths, MarkdownInstance } from 'astro'
export async function getStaticPaths(): Promise<{ params: { slug: string; }; props: { post: any; related: any; } }[]> {
export const getStaticPaths: GetStaticPaths = async () => {
const allBlogPosts = await Astro.glob('@/content/blog/**/*.md')
const posts = allBlogPosts.filter((j) => j.frontmatter.published)
return posts.map((post) => {
Expand All @@ -30,7 +31,7 @@ export async function getStaticPaths(): Promise<{ params: { slug: string; }; pro
})
}
const data = Astro.props.post
const data = Astro.props.post as MarkdownInstance<Record<string, any>>
const related = Astro.props.related
const config = useRuntimeConfig()
Expand Down
21 changes: 9 additions & 12 deletions src/pages/plugins/[id].astro
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
import { marked } from 'marked'
import { useRuntimeConfig } from '@/config/app'
import type { Plugin } from '@/config/plugins'
import { actions } from '@/config/plugins'
import Layout from '@/layouts/Layout.astro'
import type { Plugin } from '@/config/plugins'
import { useRuntimeConfig } from '@/config/app'
import VuePluginPDP from '@/vue-pages/plugins/[id].vue'
import { fetchWithToken, getSlug } from '@/services/github'
import { defaultLocale, type Locales } from '@/services/locale'
import VuePluginPDP from '@/vue-pages/plugins/[id].vue'
import type { GetStaticPaths } from 'astro'
import { marked } from 'marked'
export async function getStaticPaths(): Promise<{ params: { id: string; }; props: { item: any; tutorial: any; } }[]> {
export const getStaticPaths: GetStaticPaths = async () => {
let tutMap: any = {}
const promises: any[] = []
let processTuts: Plugin[] = []
Expand Down Expand Up @@ -100,20 +101,16 @@ export async function getStaticPaths(): Promise<{ params: { id: string; }; props
})
}
const plugin = Astro.props.item
const plugin = Astro.props.item as Plugin
let tutorial = Astro.props.tutorial
if (tutorial) {
if (tutorial && typeof tutorial === 'string') {
const tmp = marked.parse(tutorial)
if (typeof tmp !== 'string') plugin['tutorial'] = await tmp
else plugin['tutorial'] = tmp
}
if (!plugin || !plugin.title) {
return new Response(null, {
status: 404,
})
}
if (!plugin || !plugin.title) return new Response(null, { status: 404 })
const { id } = Astro.params
const config = useRuntimeConfig()
Expand Down
2 changes: 1 addition & 1 deletion src/services/translations.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/vue-pages/blog/[slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ onMounted(() => window.addEventListener('scroll', handleScroll))
function handleScroll() {
if (staticToc.value && fixedToc.value) {
const staticTocRect = staticToc.value.getBoundingClientRect()
// const articleRect = article.value.getBoundingClientRect()
isFixedTocVisible.value = staticTocRect.top <= 80
}
observeArticleTitles()
Expand Down

0 comments on commit f3385c7

Please sign in to comment.