sentinel166
Coder
Hi,
I use the hugo SSG and up until now, a theme which I just customized to make it responsive, but not much beyond.
However I'm sick that each time I modify one thing i have ten more things that bugs for reasons I don't understand and still don't after I somehow resolved the issue, by chance.
I decided to redo the layout in its entirety, from top to bottom, and actually understand everything.
I decided on the grid model since it felt more intuitive to me, at least the idea.
But I can't make it work at all, the explanations I found are as confusing as insufficient as for any other model...
This is the basic css, stripped down to what matters, (although you can find a sample repo here):
And this is the basic html tree:
Here's what it should look like, approximately:
As you can see in the pictures, It's not really what it looks like !
the second one is the homepage, without table of content. I confess not having taken that case into account in the css. the html for the homepage does not contain #book-toc.
What am I supposed to do for grid to work ?! it won't even go where it's supposed to, let alone limit themselves to 15vw or whatnot !
Or did I miss something glaring in my code ?
thanks for your help, I'm very new at that kind of thing, and feel very dumb sometimes...
I use the hugo SSG and up until now, a theme which I just customized to make it responsive, but not much beyond.
However I'm sick that each time I modify one thing i have ten more things that bugs for reasons I don't understand and still don't after I somehow resolved the issue, by chance.
I decided to redo the layout in its entirety, from top to bottom, and actually understand everything.
I decided on the grid model since it felt more intuitive to me, at least the idea.
But I can't make it work at all, the explanations I found are as confusing as insufficient as for any other model...
This is the basic css, stripped down to what matters, (although you can find a sample repo here):
CSS:
html {
* {
padding:0;
margin:0;
}
}
body {
* {
box-sizing: inherit;
}
> * {
max-width: auto;
max-height:auto;
}
display:grid;
grid: 15vw auto 15vw / clamp(4rem,9vw,9vw) auto;
grid-template-areas:
'brand book-page book-toc'
'book-menu book-page book-toc'
}
#book-menu {
grid-area: book-menu ;
}
#book-toc {
grid-area: book-toc;
}
#book-page {
grid-area:book-page;
}
#brand {
grid-area: brand;
place-self: center;
justify-content:center;
}
HTML:
<!DOCTYPE html>
<html lang="{{ default site.Language.Lang site.LanguageCode }}" dir="{{ default "ltr" site.Language.LanguageDirection }}">
<body dir="{{ default "ltr" site.Language.LanguageDirection }}"{{with .Page.Params.style}} class="{{.}}"{{end}}>
{{ partial "docs/brand" . }}
<aside id="book-menu">
{{ partial "docs/menu" . }}
</aside>
<article id="book-page">
</article>
<aside class="hidden clearfix">
{{ partial "docs/toc" . }}
</aside>
<aside id="book-toc">
{{ partial "docs/toc" . }}
</aside>
{{ partial "docs/inject/body" . }}
</body>
</html>
As you can see in the pictures, It's not really what it looks like !
the second one is the homepage, without table of content. I confess not having taken that case into account in the css. the html for the homepage does not contain #book-toc.
What am I supposed to do for grid to work ?! it won't even go where it's supposed to, let alone limit themselves to 15vw or whatnot !
Or did I miss something glaring in my code ?
thanks for your help, I'm very new at that kind of thing, and feel very dumb sometimes...
Last edited: