Fixed index page for static page and simple routing issue.

master
Tomasz Półgrabia 2022-01-30 20:54:55 +01:00
parent 1671d19134
commit d7621aa1d1
2 changed files with 22 additions and 25 deletions

View File

@ -2,14 +2,13 @@
<div id="app-top">
<nav class="navbar is-light" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="#">
<NuxtLink to="/" class="navbar-item" onclick="switchOffMenu()">
<div class="logo">
<h2 class="subtitle">
<NuxtLink to="/" class="navbar-item" onclick="switchOffMenu()">Tomasz Półgrabia
</NuxtLink>
Tomasz Półgrabia
</h2>
</div>
</a>
</NuxtLink>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
data-target="navbarBasicExample">
@ -61,17 +60,7 @@
</div>
</div>
</nav>
</div>
</template>
<script>
export default {
name: 'Navigation',
created() {
console.log(`Process ${process.client} ${process.server}`);
if (process.server || window.initialized) {
return;
}
<script>
window.toggleMenu = function () {
document.getElementById('navbarBasicExample').classList.toggle('is-active');
document.querySelector('#app-top .navbar-burger').classList.toggle('is-active');
@ -82,12 +71,12 @@ export default {
document.querySelector('#app-top .navbar-burger').classList.remove('is-active');
};
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('DOMContentLoaded', function() {
let hoverableEls =
Array.prototype.slice.call(document.querySelectorAll('.has-dropdown'), 0);
hoverableEls.forEach(el => {
el.addEventListener('click', (event) => {
hoverableEls.forEach(function(el) {
el.addEventListener('click', function(event) {
event.stopPropagation();
let dropdownEl = event.target.closest('.has-dropdown');
dropdownEl.classList.toggle('is-active');
@ -96,14 +85,17 @@ export default {
let navbarBurger = document.querySelector('#app-top .navbar-burger');
if (navbarBurger) {
navbarBurger.addEventListener('click', () => {
navbarBurger.addEventListener('click', function() {
window.toggleMenu();
});
}
});
window.initialized = true;
}
</script>
</div>
</template>
<script>
export default {
name: 'Navigation',
}
</script>

View File

@ -12,7 +12,7 @@ export default {
let postRoutes = listOfPosts
.map(it => it.slug)
.map((slug) => {
return '/post/' + slug;
return '/blog/post/' + slug;
});
return postRoutes;
@ -24,7 +24,7 @@ export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'nuxt_demo1',
title: 'Tomasz Półgrabia\'s BLog',
htmlAttrs: {
lang: 'en'
},
@ -60,6 +60,11 @@ export default {
config.node = {
fs: 'empty'
};
// disable for production
config.devtool = 'source-map';
}
}
},
ssr: true
}