Skip to content

Commit

Permalink
add microCMS
Browse files Browse the repository at this point in the history
  • Loading branch information
shim369 committed Sep 17, 2023
1 parent e04471d commit 226c7e2
Show file tree
Hide file tree
Showing 12 changed files with 382 additions and 479 deletions.
15 changes: 0 additions & 15 deletions plugins/newt.ts

This file was deleted.

13 changes: 5 additions & 8 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ["nuxt-microcms-module"],
microCMS: {
serviceDomain: process.env.MICROCMS_SERVICE_DOMAIN,
apiKey: process.env.MICROCMS_API_KEY,
},
devtools: { enabled: true },
build: {
transpile: ['gsap']
Expand All @@ -11,14 +16,6 @@ export default defineNuxtConfig({
},
},
},
runtimeConfig: {
public: {
newt: {
spaceUid: process.env.NEWT_SPACE_UID,
token: process.env.NEWT_CDN_API_TOKEN
}
}
},
typescript: {
typeCheck: true
},
Expand Down
365 changes: 105 additions & 260 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@nuxt/image": "^0.7.1",
"gsap": "^3.12.2",
"newt-client-js": "^3.2.6",
"nuxt-microcms-module": "^3.0.2",
"vue-tsc": "^1.8.8"
}
}
5 changes: 5 additions & 0 deletions pages/404.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<h1>404: Page not found</h1>
</div>
</template>
36 changes: 36 additions & 0 deletions pages/articles/[id].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<main>
<template v-if="data">
<h1>
{{ data.title }}
</h1>
<img
:src="data.eyecatch?.url"
:width="data.eyecatch?.width"
:height="data.eyecatch?.height"
alt=""
/>
<div>
<div>
{{ data.category?.name }}
</div>
<div>
{{ data.publishedAt ?? data.createdAt }}
</div>
</div>
<div v-html="data.content"></div>
</template>
</main>
</template>

<script setup lang="ts">
import { Blog } from "../../types/blog";
const { params } = useRoute();
const { data } = await useMicroCMSGetListDetail<Blog>({
endpoint: "blogs",
contentId: Array.isArray(params.id) ? params.id[0] : params.id,
});
console.log(data)
</script>
Loading

0 comments on commit 226c7e2

Please sign in to comment.