Additional page name as css class

This commit is contained in:
Bastien Wirtz 2022-08-26 21:52:28 +02:00
parent 18d9582d7b
commit 34259e1e94

View File

@ -4,6 +4,7 @@
v-if="config" v-if="config"
:class="[ :class="[
`theme-${config.theme}`, `theme-${config.theme}`,
`page-${currentPage}`,
isDark ? 'is-dark' : 'is-light', isDark ? 'is-dark' : 'is-light',
!config.footer ? 'no-footer' : '', !config.footer ? 'no-footer' : '',
]" ]"
@ -171,6 +172,7 @@ export default {
data: function () { data: function () {
return { return {
loaded: false, loaded: false,
currentPage: null,
configNotFound: false, configNotFound: false,
config: null, config: null,
services: null, services: null,
@ -202,14 +204,11 @@ export default {
let config; let config;
try { try {
config = await this.getConfig(); config = await this.getConfig();
const path = this.currentPage = window.location.hash.substring(1) || "default";
window.location.hash.substring(1) != ""
? window.location.hash.substring(1)
: null;
if (path) { if (this.currentPage !== "default") {
let pathConfig = await this.getConfig(`assets/${path}.yml`); // the slash (/) is included in the pathname let pageConfig = await this.getConfig(`assets/${this.currentPage}.yml`);
config = Object.assign(config, pathConfig); config = Object.assign(config, pageConfig);
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);