diff options
author | HampusM <hampus@hampusmat.com> | 2021-06-11 22:18:45 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-06-11 22:18:45 +0200 |
commit | 88dca239e50d51acb5e12174c6bd0df8c4bc3b7b (patch) | |
tree | 4233094a0f83eee3f98033957b7d0beac35b2441 /packages/client | |
parent | b2e0d3154336946336edee4e32b57a467e255050 (diff) |
Implemented title and favicon stuff
Diffstat (limited to 'packages/client')
-rw-r--r-- | packages/client/public/favicon.ico | bin | 4286 -> 67646 bytes | |||
-rw-r--r-- | packages/client/src/App.vue | 27 | ||||
-rw-r--r-- | packages/client/src/router/index.js | 6 | ||||
-rw-r--r-- | packages/client/vue.config.js | 8 |
4 files changed, 38 insertions, 3 deletions
diff --git a/packages/client/public/favicon.ico b/packages/client/public/favicon.ico Binary files differindex df36fcf..444889b 100644 --- a/packages/client/public/favicon.ico +++ b/packages/client/public/favicon.ico diff --git a/packages/client/src/App.vue b/packages/client/src/App.vue index e74b3f9..0c50f3a 100644 --- a/packages/client/src/App.vue +++ b/packages/client/src/App.vue @@ -2,6 +2,33 @@ <router-view /> </template> +<script> +export default { + name: "App", + data: function() { + return { + base_title: "" + }; + }, + methods: { + setTitle() { + const repo = this.$route.params.repo; + const route = this.$route.name; + document.title = repo ? `${repo} - ${route}` : this.base_title; + } + }, + created() { + this.base_title = document.title; + this.setTitle(); + }, + watch: { + $route() { + this.setTitle(); + } + } +}; +</script> + <style lang="scss"> @use "scss/colors"; @use "scss/variables"; diff --git a/packages/client/src/router/index.js b/packages/client/src/router/index.js index a6db1e1..ed53590 100644 --- a/packages/client/src/router/index.js +++ b/packages/client/src/router/index.js @@ -15,12 +15,12 @@ const routes = [ children: [ { path: "about", - name: "Repository About", + name: "About", component: () => import("../views/RepositoryAbout") }, { path: "log", - name: "Repository Log", + name: "Log", component: () => import("../views/RepositoryLog") }, { @@ -31,7 +31,7 @@ const routes = [ }, { path: "tree/:path*", - name: "Tree Entry", + name: "Tree", component: () => import("../views/RepositoryTree"), props: route => ({ pathArr: route.params.path ? route.params.path : [] }) }, diff --git a/packages/client/vue.config.js b/packages/client/vue.config.js index 94cfb20..f35b739 100644 --- a/packages/client/vue.config.js +++ b/packages/client/vue.config.js @@ -21,5 +21,13 @@ module.exports = { changeOrigin: true } } + }, + chainWebpack: config => { + config + .plugin("html") + .tap(args => { + args[0].title = settings.title; + return args; + }); } }; |