mirror of
https://github.com/bastienwirtz/homer.git
synced 2025-03-13 06:49:32 +01:00
Additional page name as css class
This commit is contained in:
parent
18d9582d7b
commit
34259e1e94
13
src/App.vue
13
src/App.vue
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user