Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add include component #119

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions components/content/Include.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script setup lang="ts">
const props = defineProps<{ path: string; }>();

const { data } = await useAsyncData(props.path, () => queryContent(props.path).findOne());
</script>
ninedev-i marked this conversation as resolved.
Show resolved Hide resolved

<template>
<ContentRenderer v-if="data" :value="data" />
</template>
ninedev-i marked this conversation as resolved.
Show resolved Hide resolved

6 changes: 6 additions & 0 deletions doc/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

Компоненты позволяют избежать использование html, css и js в файлах .md, а также стандартизируют внешний вид страниц. Если вам не хватило возможностей языка Markdown и существующих компонентов — обратитесь к разработчикам, они создадут компонент для решения вашей задачи.

## Инклюд

```
:include{path="Путь до md файла внутри локали (например "/_integrators/abrom"}
```

## Спойлер для скрытия контента

```
Expand Down
Loading