diff --git a/Dockerfile b/Dockerfile index b7e87c1cbce41b77126c5420aa550ed78dcc171c..2420a62e64c5701465918a23dab4474b6f11d883 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,9 @@ RUN npm install ### STAGE: Dev FROM node:19.5-bullseye-slim as dev +ARG BASE_URL=/ +ENV NUXT_APP_BASE_URL=${BASE_URL} WORKDIR /usr/src/app COPY --from=install /usr/src/app ./ COPY . /usr/src/app diff --git a/components/Nav/Navbar.vue b/components/Nav/Navbar.vue index 9b0dc3f11cf760c82baea2fb60421ed043a935bb..281ba3bf5955a188861f7809b1c76d1059dcde9f 100644 --- a/components/Nav/Navbar.vue +++ b/components/Nav/Navbar.vue @@ -27,20 +27,20 @@ const sections = ref([ ]); -const computedSections = computed(() => { - return sections.value.map(section => { +// const computedSections = computed(() => { +// return sections.value.map(section => { - if (section?.to) { - const { refinedUrl } = useRefinedUrl(section.to) - return { ...section, to: refinedUrl.value } - } - else { - return section - } +// if (section?.to) { +// const { refinedUrl } = useRefinedUrl(section.to) +// return { ...section, to: refinedUrl.value } +// } +// else { +// return section +// } - }) -}) +// }) +// }) const drawer = ref(true); @@ -76,7 +76,7 @@ const computedNavigation = computed(() => { </span> </v-app-bar-title> <template #append v-if="!mobile"> - <v-btn v-for="section in computedSections" :key="section.id" color="primary" :to="section?.to ?? null" + <v-btn v-for="section in sections" :key="section.id" color="primary" :to="section?.to ?? null" :href="section?.href ?? null" exact> {{ section.label }} </v-btn> diff --git a/composables/useRefinedUrl.ts b/composables/useRefinedUrl.ts index bd6793341ee4ac036cb886ea98984ae1bf0c945e..3e81d7c32b9a0a529ae010b7490ad57e2aafc584 100644 --- a/composables/useRefinedUrl.ts +++ b/composables/useRefinedUrl.ts @@ -1,13 +1,17 @@ +import { join } from "path"; import { withTrailingSlash, withLeadingSlash, joinURL } from "ufo"; export function useRefinedUrl(url: string | Ref<string>) { + console.log(useRuntimeConfig().app.baseURL) const refinedUrl = computed(() => { const sanitzedUrl = toValue(url) + if (sanitzedUrl.startsWith("/") && !sanitzedUrl.startsWith("//")) { const _base = withLeadingSlash( withTrailingSlash(useRuntimeConfig().app.baseURL) ); + console.log(_base) if (_base !== "/" && !sanitzedUrl.startsWith(_base)) { return joinURL(_base, sanitzedUrl); } diff --git a/docker-compose.yml b/docker-compose.yml index db77b855f2ae404bc312e2c752c109f8291f9daa..972dd12abc1995c85d5b13a3c69ce004cd80d672 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: build: context: . target: dev + args: + BASE_URL: /wiki/ container_name: nuxt environment: HOST: 0.0.0.0 diff --git a/pages/defense-systems.vue b/pages/defense-systems.vue index 14f690ee46ac73b756dd205ff5fc4bb971fdc9ee..c455cf83c665376934bad976a9c48fd8e272ddbe 100644 --- a/pages/defense-systems.vue +++ b/pages/defense-systems.vue @@ -48,6 +48,8 @@ const systems = computed(() => { }; }); }); + + </script> <template> <v-card flat color="transparent">