Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
rishi-raj-jain committed Oct 5, 2024
1 parent f91e5cb commit 09b2c81
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 80 deletions.
1 change: 1 addition & 0 deletions src/config/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface Plugin extends Action {
datePublished?: string
dateModified?: string
tutorial?: string
locale?: string
}

export const actions = [
Expand Down
29 changes: 6 additions & 23 deletions src/pages/blog/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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()
Expand Down
20 changes: 6 additions & 14 deletions src/pages/blog/index.astro
Original file line number Diff line number Diff line change
@@ -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
---

<Layout content={content}>
Expand Down
15 changes: 0 additions & 15 deletions src/pages/fr/pricing.astro

This file was deleted.

18 changes: 5 additions & 13 deletions src/pages/plugins/[id].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
---

<Layout content={content}>
Expand Down
5 changes: 0 additions & 5 deletions src/pages/sponsors.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -86,7 +83,6 @@ export const GET: APIRoute = async ({ params, request }) => {
return 'baker'
}
}

const sponsors = allSponsors.map((sponsorship) => {
const sponsor = sponsorship.sponsorEntity
return {
Expand All @@ -97,7 +93,6 @@ export const GET: APIRoute = async ({ params, request }) => {
tier: calculateTier(sponsorship),
}
})

return new Response(JSON.stringify(sponsors), {
status: 200,
headers: {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/status.json.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/top_app.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/top_capacitor_app.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/top_capgo_app.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/top_cordova_app.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/top_flutter_app.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/top_kotlin_app.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/top_native_script_app.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/top_react_native_app.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 09b2c81

Please sign in to comment.