Skip to content

Commit

Permalink
fix: add article id to handle on Studio (#134)
Browse files Browse the repository at this point in the history
* feat: add `data-content-id` to articles in preview mode

* chore: upgrade deps

* fix: disable inlineSSRStyles for now

---------

Co-authored-by: Farnabaz <[email protected]>
  • Loading branch information
atinux and farnabaz authored May 10, 2023
1 parent 0335844 commit 542cd9e
Show file tree
Hide file tree
Showing 4 changed files with 1,378 additions and 1,424 deletions.
11 changes: 9 additions & 2 deletions components/content/ArticlesListItem.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script setup lang="ts">
import { useContentPreview } from '#imports'
type Article = {
_path: string
title: string
date: string
description: string
}
defineProps({
const props = defineProps({
article: {
type: Object,
required: true,
Expand All @@ -20,10 +22,15 @@ defineProps({
default: false
}
})
const id = computed(() => {
// @ts-ignore
return (process.dev || useContentPreview()?.isEnabled()) ? props.article?._id : undefined
})
</script>

<template>
<article v-if="article._path && article.title" :class="{ 'featured': featured }">
<article v-if="article._path && article.title" :class="{ 'featured': featured }" :data-content-id="id">
<div class="image">
<NuxtLink :to="article._path">
<NuxtImg v-if="article.cover" :src="article.cover" :alt="article.title" width="16" height="9" />
Expand Down
3 changes: 3 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@ export default defineNuxtConfig({
},
preload: ['json', 'js', 'ts', 'html', 'css', 'vue', 'diff', 'shell', 'markdown', 'yaml', 'bash', 'ini', 'c', 'cpp']
}
},
experimental: {
inlineSSRStyles: false
}
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@nuxt/eslint-config": "^0.1.1",
"@nuxtjs/plausible": "^0.2.1",
"eslint": "^8.40.0",
"nuxt": "3.4.2",
"nuxt": "^3.4.3",
"release-it": "^15.10.3",
"typescript": "^5.0.4",
"vue": "^3.2.47"
Expand Down
Loading

0 comments on commit 542cd9e

Please sign in to comment.