From 56d32a69288e62a29c4f0f3f370ba7890a39686c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 12 Sep 2019 09:20:18 +0200 Subject: [PATCH] Fix gitlab page --- .gitlab-ci.yml | 3 ++- public/index.html | 4 ++-- src/components/Header.vue | 2 +- src/components/I18n.vue | 2 +- src/main.js | 6 +++++- src/mixins/Common-Mixins.js | 2 +- vue.config.js | 4 +++- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2569f9a..fc516db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,9 +7,10 @@ pages: script: - yarn install --pure-lockfile - npm run build + - rm -r public/ && mv dist/ public/ artifacts: paths: - - dist + - public cache: paths: - node_modules/ diff --git a/public/index.html b/public/index.html index 9be77ea..ddde42e 100644 --- a/public/index.html +++ b/public/index.html @@ -5,8 +5,8 @@ - - + + diff --git a/src/components/Header.vue b/src/components/Header.vue index 568bb8a..f6908b8 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -111,7 +111,7 @@ methods: { getPath (path) { - return path + return process.env.BASE_URL + path } } } diff --git a/src/components/I18n.vue b/src/components/I18n.vue index 8271da9..a216cb2 100644 --- a/src/components/I18n.vue +++ b/src/components/I18n.vue @@ -68,7 +68,7 @@ methods: { buildLocaleLink (locale) { - return window.location.origin + `/${locale}/` + return process.env.BASE_URL + `${locale}/` } } } diff --git a/src/main.js b/src/main.js index 1306804..2a8fef5 100644 --- a/src/main.js +++ b/src/main.js @@ -54,6 +54,10 @@ Vue.component('vue-headful', vueHeadful) Vue.mixin(CommonMixins) const routes = [ + { + path: '', + component: Home + }, { path: '/', component: Home @@ -73,7 +77,7 @@ for (const locale of allLocales) { const router = new VueRouter({ mode: 'history', - base: `${__dirname}${process.env.BASE_URL}`, + base: process.env.BASE_URL, routes }) diff --git a/src/mixins/Common-Mixins.js b/src/mixins/Common-Mixins.js index f616d18..ee3d2db 100644 --- a/src/mixins/Common-Mixins.js +++ b/src/mixins/Common-Mixins.js @@ -1,7 +1,7 @@ export default { methods: { buildImgUrl: function (imageName) { - return '/img/' + imageName + return process.env.BASE_URL + 'img/' + imageName } } } diff --git a/vue.config.js b/vue.config.js index 00858dc..2c9467d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,3 +1,5 @@ module.exports = { - // options... + publicPath: process.env.GITLAB_CI + ? '/joinpeertube/' + : '/' }