Skip to content

Commit

Permalink
fix: use config for blog page
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Jul 29, 2023
1 parent b7d23a3 commit a874242
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
10 changes: 7 additions & 3 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ function getRightKey(branch: string, keyname: 'base_domain' | 'supa_anon' | 'sup
return keys[keyname].prod
}

const brand = 'Capgo'
const blogTitle = `${brand} | Capacitor Blog`
const blogDescription = 'The best articles to enhance your Capacitor app. Do more with Capacitor and Capgo. Learn how to build a modern app with Capacitor.'

function getUrl(branch = ''): string {
if (branch === 'local')
return `http://${getRightKey(branch, 'base_domain')}`
Expand Down Expand Up @@ -128,11 +132,11 @@ export default defineNuxtConfig({
},
runtimeConfig: {
public: {
brand: 'Capgo',
brand,
blog_title: blogTitle,
blog_description: blogDescription,
baseUrl: getUrl(process.env.BRANCH),
baseApiUrl: getApiUrl(process.env.BRANCH),
crisp: 'e7dbcfa4-91b1-4b74-b563-b9234aeb2eee',
handler: 'capgo',
},
supa_anon: `${getRightKey(process.env.BRANCH!, 'supa_anon')}`,
supa_url: `${getRightKey(process.env.BRANCH!, 'supa_url')}`,
Expand Down
14 changes: 4 additions & 10 deletions pages/blog/index.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<script setup lang="ts">
// import type { QueryBuilderParams } from '@nuxt/content/dist/runtime/types'
import type { MyCustomParsedContent } from '~/services/blog'
import { createMeta } from '~/services/meta'
const title = 'Capgo | Capacitor Blog'
const description = 'The best articles to enhance your Capacitor app. Do more with Capacitor and Capgo. Learn how to build a modern app with Capacitor.'
// const query: QueryBuilderParams = { path: '/blog', where: [{published: true }], sort: [{ created_at: -1 }] }
const config = useRuntimeConfig()
const { data } = await useFetch<MyCustomParsedContent[]>('/api/blogs')
useHead(() => ({
title,
meta: createMeta(title, description),
title: config.public.blog_tile,
meta: createMeta(config.public.blog_tile, config.public.blog_description),
}))
</script>

Expand All @@ -26,14 +22,13 @@ useHead(() => ({
Latest from the blog
</h1>
<h2 class="max-w-xl mx-auto mt-4 text-base leading-relaxed text-gray-50">
{{ description }}
{{ config.public.blog_description }}
</h2>
</div>

<div
class="grid max-w-md grid-cols-1 gap-6 mx-auto mt-8 lg:mt-16 lg:grid-cols-3 lg:max-w-full"
>
<!-- <ContentList v-slot="{ list }" :query="query"> -->
<Blog
v-for="article in data" :key="article.slug"
:link="article.slug"
Expand All @@ -43,7 +38,6 @@ useHead(() => ({
:date="article.created_at"
:tag="article.tag"
/>
<!-- </ContentList> -->
</div>
</div>
</section>
Expand Down

0 comments on commit a874242

Please sign in to comment.