diff --git a/src/config/plugins.ts b/src/config/plugins.ts index e3f076cf..905a4c26 100644 --- a/src/config/plugins.ts +++ b/src/config/plugins.ts @@ -37,6 +37,7 @@ export interface Plugin extends Action { datePublished?: string dateModified?: string tutorial?: string + locale?: string } export const actions = [ diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro index 81e9e932..d5777cd3 100644 --- a/src/pages/blog/[slug].astro +++ b/src/pages/blog/[slug].astro @@ -15,12 +15,8 @@ export async function getStaticPaths() { if (post.frontmatter.next_blog) { if (related.length > 0) { const next_blog = posts.find((i) => i.frontmatter.slug === post.frontmatter.next_blog) - if (next_blog) { - related[0] = next_blog - } - } else { - related = posts.filter((i) => i.frontmatter.slug === post.frontmatter.next_blog) - } + if (next_blog) related[0] = next_blog + } else related = posts.filter((i) => i.frontmatter.slug === post.frontmatter.next_blog) } return { params: { @@ -38,26 +34,13 @@ const data = Astro.props.post const related = Astro.props.related const config = useRuntimeConfig() - const markdown = data.compiledContent() - const content: { title?: string; description?: string; image?: string; author?: string; ldJSON?: Object } = {} -if (data.frontmatter.title) { - content['title'] = data.frontmatter.title -} - -if (data.frontmatter.description) { - content['description'] = data.frontmatter.description -} - -if (data.frontmatter.head_image) { - content['image'] = `${config.public.baseUrl}${data.frontmatter.head_image || '/capgo_banner.webp'}` -} - -if (data.frontmatter.author) { - content['author'] = data.frontmatter.author || 'Capgo' -} +if (data.frontmatter.title) content['title'] = data.frontmatter.title +if (data.frontmatter.description) content['description'] = data.frontmatter.description +if (data.frontmatter.head_image) content['image'] = `${config.public.baseUrl}${data.frontmatter.head_image || '/capgo_banner.webp'}` +if (data.frontmatter.author) content['author'] = data.frontmatter.author || 'Capgo' const dateModified = new Date(data.frontmatter.updated_at).toISOString() const datePublished = new Date(data.frontmatter.created_at).toISOString() diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 7c201c71..cb5c6a2d 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -1,26 +1,18 @@ --- -let posts = await Astro.glob('@/content/blog/**/*.md') - import Layout from '@/layouts/Layout.astro' import { useRuntimeConfig } from '@/config/app' import VueBlogIndex from '@/vue-pages/blog/index.vue' import { defaultLocale, type Locales } from '@/services/locale' -posts = posts.filter((i) => i.frontmatter.published).sort((a, b) => (new Date(a.frontmatter.created_at) > new Date(b.frontmatter.created_at) ? -1 : 1)) - const config = useRuntimeConfig() - +const pageLocale = (Astro.currentLocale || defaultLocale) as Locales const content: { title?: string; description?: string; image?: string; author?: string; ldJSON?: Object } = {} +const posts = (await Astro.glob('@/content/blog/**/*.md')) + .filter((i) => i.frontmatter.published) + .sort((a, b) => (new Date(a.frontmatter.created_at) > new Date(b.frontmatter.created_at) ? -1 : 1)) -if (config.public.blog_title) { - content['title'] = config.public.blog_title -} - -if (config.public.blog_description) { - content['description'] = config.public.blog_description -} - -const pageLocale = (Astro.currentLocale || defaultLocale) as Locales +if (config.public.blog_title) content['title'] = config.public.blog_title +if (config.public.blog_description) content['description'] = config.public.blog_description --- diff --git a/src/pages/fr/pricing.astro b/src/pages/fr/pricing.astro deleted file mode 100644 index 86939de7..00000000 --- a/src/pages/fr/pricing.astro +++ /dev/null @@ -1,15 +0,0 @@ ---- -import Layout from '@/layouts/Layout.astro' -import { defaultLocale, type Locales } from '@/services/locale' -import VuePricing from '@/vue-pages/pricing.vue' - -const title = 'Capgo pricing' -const description = 'Move forward with confidence. Capgo is the enterprise-grade cloud platform for Capacitor applications.' - -const content = { - description, - title, -} ---- - - diff --git a/src/pages/plugins/[id].astro b/src/pages/plugins/[id].astro index 37d54c4e..4f8701d2 100644 --- a/src/pages/plugins/[id].astro +++ b/src/pages/plugins/[id].astro @@ -115,19 +115,13 @@ if (!plugin || !plugin.title) { }) } -const content: { title?: string; description?: string; image?: string; author?: string; ldJSON?: Object } = {} - -if (plugin.title) { - content['title'] = plugin.title -} - -if (plugin.description) { - content['description'] = plugin.description -} - +const { id } = Astro.params const config = useRuntimeConfig() +const pageLocale = (Astro.currentLocale || defaultLocale) as Locales +const content: { title?: string; description?: string; image?: string; author?: string; ldJSON?: Object } = {} -const { id } = Astro.params +if (plugin.title) content['title'] = plugin.title +if (plugin.description) content['description'] = plugin.description content['ldJSON'] = { '@context': 'https://schema.org', @@ -149,8 +143,6 @@ content['ldJSON'] = { ...(plugin.hasOwnProperty('datePublished') && { datePublished: plugin.datePublished }), ...(plugin.hasOwnProperty('dateModified') && { dateModified: plugin.dateModified }), } - -const pageLocale = (Astro.currentLocale || defaultLocale) as Locales --- diff --git a/src/pages/sponsors.json.ts b/src/pages/sponsors.json.ts index effb2f26..9431d55b 100644 --- a/src/pages/sponsors.json.ts +++ b/src/pages/sponsors.json.ts @@ -64,14 +64,11 @@ export const GET: APIRoute = async ({ params, request }) => { }, body: JSON.stringify({ query }), }) - const data = await response.json() - if (data.errors) { console.error('GraphQL Errors:', data.errors) return new Response(JSON.stringify([]), { status: 500 }) } - const allSponsors = [...(data.data.riderx?.sponsorshipsAsMaintainer.nodes || []), ...(data.data.capgo?.sponsorshipsAsMaintainer.nodes || [])] console.log('allSponsors', allSponsors) const calculateTier = (sponsorship: any) => { @@ -86,7 +83,6 @@ export const GET: APIRoute = async ({ params, request }) => { return 'baker' } } - const sponsors = allSponsors.map((sponsorship) => { const sponsor = sponsorship.sponsorEntity return { @@ -97,7 +93,6 @@ export const GET: APIRoute = async ({ params, request }) => { tier: calculateTier(sponsorship), } }) - return new Response(JSON.stringify(sponsors), { status: 200, headers: { diff --git a/src/pages/status.json.ts b/src/pages/status.json.ts index 7e542b76..d9fe4503 100644 --- a/src/pages/status.json.ts +++ b/src/pages/status.json.ts @@ -1,10 +1,9 @@ import type { APIRoute } from 'astro' -export const GET: APIRoute = async ({ params, request }) => { +export const GET: APIRoute = async () => { try { const response = await fetch('https://status.capgo.app/status.json') const data = await response.json() - return new Response(JSON.stringify(data), { status: 200, headers: { diff --git a/src/pages/top_app.astro b/src/pages/top_app.astro index 95c88d16..9d799b2b 100644 --- a/src/pages/top_app.astro +++ b/src/pages/top_app.astro @@ -3,9 +3,13 @@ import Layout from '@/layouts/Layout.astro' import { defaultLocale, type Locales } from '@/services/locale' import VueTopapp from '@/vue-pages/top_app.vue' import translations from '@/services/translations' +import { useRuntimeConfig } from '@/config/app' + +const config = useRuntimeConfig() +const brand = config.public.brand const pageLocale = (Astro.currentLocale || defaultLocale) as Locales -const title = ['Capgo', translations['top_apps_by_framework'][pageLocale]].join(' | ') +const title = [brand, translations['top_apps_by_framework'][pageLocale]].join(' | ') const description = translations['top_100_app_using_different_framworks_on_android_store'][pageLocale] const content = { diff --git a/src/pages/top_capacitor_app.astro b/src/pages/top_capacitor_app.astro index 43b6bdd1..cc4953e4 100644 --- a/src/pages/top_capacitor_app.astro +++ b/src/pages/top_capacitor_app.astro @@ -3,9 +3,13 @@ import Layout from '@/layouts/Layout.astro' import { defaultLocale, type Locales } from '@/services/locale' import VueTopcapacitorapp from '@/vue-pages/top_capacitor_app.vue' import translations from '@/services/translations' +import { useRuntimeConfig } from '@/config/app' + +const config = useRuntimeConfig() +const brand = config.public.brand const pageLocale = (Astro.currentLocale || defaultLocale) as Locales -const title = ['Capgo', translations['top_capacitor_apps'][pageLocale]].join(' | ') +const title = [brand, translations['top_capacitor_apps'][pageLocale]].join(' | ') const description = translations['top_100_app_using_capacitor_on_android_play_store'][pageLocale] const content = { diff --git a/src/pages/top_capgo_app.astro b/src/pages/top_capgo_app.astro index 46570699..96549d02 100644 --- a/src/pages/top_capgo_app.astro +++ b/src/pages/top_capgo_app.astro @@ -3,9 +3,13 @@ import Layout from '@/layouts/Layout.astro' import { defaultLocale, type Locales } from '@/services/locale' import VueTopcapgoapp from '@/vue-pages/top_capgo_app.vue' import translations from '@/services/translations' +import { useRuntimeConfig } from '@/config/app' + +const config = useRuntimeConfig() +const brand = config.public.brand const pageLocale = (Astro.currentLocale || defaultLocale) as Locales -const title = ['Capgo', translations['top_capgo_apps_title'][pageLocale]].join(' | ') +const title = [brand, translations['top_capgo_apps_title'][pageLocale]].join(' | ') const description = translations['top_capgo_apps'][pageLocale] const content = { diff --git a/src/pages/top_cordova_app.astro b/src/pages/top_cordova_app.astro index b1efa028..234a5bf7 100644 --- a/src/pages/top_cordova_app.astro +++ b/src/pages/top_cordova_app.astro @@ -3,9 +3,13 @@ import Layout from '@/layouts/Layout.astro' import { defaultLocale, type Locales } from '@/services/locale' import VueTopcordovaapp from '@/vue-pages/top_cordova_app.vue' import translations from '@/services/translations' +import { useRuntimeConfig } from '@/config/app' + +const config = useRuntimeConfig() +const brand = config.public.brand const pageLocale = (Astro.currentLocale || defaultLocale) as Locales -const title = ['Capgo', translations['top_cordova_apps_title'][pageLocale]].join(' | ') +const title = [brand, translations['top_cordova_apps_title'][pageLocale]].join(' | ') const description = translations['top_cordova_apps'][pageLocale] const content = { diff --git a/src/pages/top_flutter_app.astro b/src/pages/top_flutter_app.astro index a001943b..db2d2c21 100644 --- a/src/pages/top_flutter_app.astro +++ b/src/pages/top_flutter_app.astro @@ -3,9 +3,13 @@ import Layout from '@/layouts/Layout.astro' import { defaultLocale, type Locales } from '@/services/locale' import VueTopflutterapp from '@/vue-pages/top_flutter_app.vue' import translations from '@/services/translations' +import { useRuntimeConfig } from '@/config/app' + +const config = useRuntimeConfig() +const brand = config.public.brand const pageLocale = (Astro.currentLocale || defaultLocale) as Locales -const title = ['Capgo', translations['top_flutter_apps_title'][pageLocale]].join(' | ') +const title = [brand, translations['top_flutter_apps_title'][pageLocale]].join(' | ') const description = translations['top_flutter_apps'][pageLocale] const content = { diff --git a/src/pages/top_kotlin_app.astro b/src/pages/top_kotlin_app.astro index 75107989..3288b1ce 100644 --- a/src/pages/top_kotlin_app.astro +++ b/src/pages/top_kotlin_app.astro @@ -3,9 +3,13 @@ import Layout from '@/layouts/Layout.astro' import { defaultLocale, type Locales } from '@/services/locale' import translations from '@/services/translations' import VueTopkotlinapp from '@/vue-pages/top_kotlin_app.vue' +import { useRuntimeConfig } from '@/config/app' + +const config = useRuntimeConfig() +const brand = config.public.brand const pageLocale = (Astro.currentLocale || defaultLocale) as Locales -const title = ['Capgo', translations['top_kotlin_apps_title'][pageLocale]].join(' | ') +const title = [brand, translations['top_kotlin_apps_title'][pageLocale]].join(' | ') const description = translations['top_kotlin_apps'][pageLocale] const content = { diff --git a/src/pages/top_native_script_app.astro b/src/pages/top_native_script_app.astro index 6a8b8678..433e8d5e 100644 --- a/src/pages/top_native_script_app.astro +++ b/src/pages/top_native_script_app.astro @@ -3,9 +3,13 @@ import Layout from '@/layouts/Layout.astro' import { defaultLocale, type Locales } from '@/services/locale' import translations from '@/services/translations' import VueTopnativescriptapp from '@/vue-pages/top_native_script_app.vue' +import { useRuntimeConfig } from '@/config/app' + +const config = useRuntimeConfig() +const brand = config.public.brand const pageLocale = (Astro.currentLocale || defaultLocale) as Locales -const title = ['Capgo', translations['top_native_script_apps_title'][pageLocale]].join(' | ') +const title = [brand, translations['top_native_script_apps_title'][pageLocale]].join(' | ') const description = translations['top_native_script_apps'][pageLocale] const content = { diff --git a/src/pages/top_react_native_app.astro b/src/pages/top_react_native_app.astro index d4cb75c7..97948e24 100644 --- a/src/pages/top_react_native_app.astro +++ b/src/pages/top_react_native_app.astro @@ -3,9 +3,13 @@ import Layout from '@/layouts/Layout.astro' import { defaultLocale, type Locales } from '@/services/locale' import translations from '@/services/translations' import VueTopreactnativeapp from '@/vue-pages/top_react_native_app.vue' +import { useRuntimeConfig } from '@/config/app' + +const config = useRuntimeConfig() +const brand = config.public.brand const pageLocale = (Astro.currentLocale || defaultLocale) as Locales -const title = ['Capgo', translations['top_react_native_apps_title'][pageLocale]].join(' | ') +const title = [brand, translations['top_react_native_apps_title'][pageLocale]].join(' | ') const description = translations['top_react_native_apps'][pageLocale] const content = {