-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#542): use druxt-router for guide content
- Loading branch information
Showing
1 changed file
with
4 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,10 @@ | ||
<template> | ||
<div> | ||
<!-- TODO: Add breadcrumb / path --> | ||
<NuxtContent | ||
v-if="document" | ||
<!-- @TODO: Add breadcrumb / path --> | ||
<!-- @TODO: Multilingual content support --> | ||
<DruxtRouter | ||
class="prose prose-sm sm:prose lg:prose-lg xl:prose-xl" | ||
:document="document" | ||
:path="`/en${$route.fullPath}`" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "AppGuideDocument", | ||
async asyncData({ $content, error, params, store, route }) { | ||
const path = params.pathMatch || "README"; | ||
let response; | ||
try { | ||
response = await $content("guide/", params.pathMatch || "README").fetch(); | ||
} catch (e) { | ||
return error({ message: "Document not found" }); | ||
} | ||
store.commit("addRecent", { text: response.title, to: route.path }); | ||
return { document: response, path }; | ||
}, | ||
head() { | ||
return { | ||
title: this.document.title, | ||
}; | ||
}, | ||
}; | ||
</script> |