From 139cd0ec6c404ae547cd2b281b081efb3c060310 Mon Sep 17 00:00:00 2001 From: Daniel Olabemiwo Date: Tue, 30 May 2023 19:45:23 +0100 Subject: [PATCH 1/3] chore: add github repository link --- layouts/default.vue | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/layouts/default.vue b/layouts/default.vue index a303a12..705b618 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -14,35 +14,21 @@ const color = useColorModeValue('gray.700', 'white'); - + - + -

Edit this page on GitHub

+ + Edit this page on GitHub +
From fec6070d8ba5b958ecffe4678560874801024b9a Mon Sep 17 00:00:00 2001 From: Daniel Olabemiwo Date: Thu, 22 Jun 2023 07:45:59 +0100 Subject: [PATCH 2/3] chore: rewrite the edit on github structure --- components/EditPage.vue | 17 +++++++++++++++++ config/site-config.ts | 3 ++- layouts/default.vue | 27 +++++++++++++++++++-------- 3 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 components/EditPage.vue diff --git a/components/EditPage.vue b/components/EditPage.vue new file mode 100644 index 0000000..6cc3c55 --- /dev/null +++ b/components/EditPage.vue @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/config/site-config.ts b/config/site-config.ts index d6d3c37..a540ed0 100644 --- a/config/site-config.ts +++ b/config/site-config.ts @@ -1,6 +1,7 @@ const baseUrl = 'https://github.com/chakra-ui/chakra-ui-vue-next'; const siteUrl = 'https://vue.chakra-ui.com'; +const documentationUrl = 'https://github.com/chakra-ui/vue-docs/blob/main'; const siteDescription = 'Simple, Modular and Accessible UI Components for your Vue Applications.'; const siteName = 'Chakra UI Vue | Build accessible Vue apps with speed'; @@ -54,4 +55,4 @@ const siteConfig = { }; export default siteConfig; -export { baseUrl, siteDescription, siteLang, siteName, siteUrl }; +export { baseUrl, documentationUrl, siteDescription, siteLang, siteName, siteUrl }; diff --git a/layouts/default.vue b/layouts/default.vue index 705b618..9634ee0 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -2,17 +2,34 @@ import { chakra, useColorModeValue } from '@chakra-ui/vue-next'; import TopNavigation from '~/components/navigation/top-navigation.vue'; import Sidebar from '~/components/navigation/sidebar.vue'; +import { documentationUrl } from '~/config/site-config'; +import { useRoute } from 'vue-router'; + /** * Styling */ const color = useColorModeValue('gray.700', 'white'); + +/** + * Edit pages/content on github dynamic route for edit URL at page footer + */ +const route = useRoute(); +const { path } = useRoute(); + +const { data } = await useAsyncData(`content-${path}`, () => { + return queryContent().where({ _path: path }).findOne() +}, { watch: [route] }) + +const routeSlug = data.value?._id.toString().replace(/:/g, "/").replace(/\s/g, ""); + +const editUrl = ref(`${documentationUrl}/${routeSlug}`); - \ No newline at end of file diff --git a/layouts/default.vue b/layouts/default.vue index 9634ee0..9d6a46b 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -2,7 +2,6 @@ import { chakra, useColorModeValue } from '@chakra-ui/vue-next'; import TopNavigation from '~/components/navigation/top-navigation.vue'; import Sidebar from '~/components/navigation/sidebar.vue'; -import { documentationUrl } from '~/config/site-config'; import { useRoute } from 'vue-router'; @@ -14,16 +13,9 @@ const color = useColorModeValue('gray.700', 'white'); /** * Edit pages/content on github dynamic route for edit URL at page footer */ -const route = useRoute(); -const { path } = useRoute(); +const route = computed(() => useRoute()); +const path = computed(() => route.value.path); -const { data } = await useAsyncData(`content-${path}`, () => { - return queryContent().where({ _path: path }).findOne() -}, { watch: [route] }) - -const routeSlug = data.value?._id.toString().replace(/:/g, "/").replace(/\s/g, ""); - -const editUrl = ref(`${documentationUrl}/${routeSlug}`);