basic home button

This commit is contained in:
Jean-Marie 'Histausse' Mineau 2026-03-18 23:06:39 +01:00
parent 49c9b373d6
commit db42d9b926
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
4 changed files with 34 additions and 2 deletions

View file

@ -16,3 +16,4 @@
html.elem("icon-container", attrs: args.named(), body) html.elem("icon-container", attrs: args.named(), body)
} }
#let nav-menu = html.elem.with("nav-menu") #let nav-menu = html.elem.with("nav-menu")
#let home-symbol = html.elem.with("home-symbol")

View file

@ -7,6 +7,8 @@
#let html_body( #let html_body(
/// The visible header of the page /// The visible header of the page
header: none, header: none,
/// Home button, more or less expect an image in a link
home: none,
/// The footer of the page /// The footer of the page
footer: none, footer: none,
/// Logo of the site /// Logo of the site
@ -39,6 +41,20 @@
margin-left: 0.25rem; margin-left: 0.25rem;
margin-right: 0.25rem; margin-right: 0.25rem;
} }
/* Typst keep inserting <p> tags everywhere */
& > p {
margin-top: 0.25rem;
margin-bottom: 0.25rem;
}
home-symbol, home-symbol a {
display: flex;
justify-content: center;
align-items: center;
/*height: 100%;*/
}
} }
site-container { site-container {
@ -48,8 +64,10 @@
padding: 0 20px; padding: 0 20px;
header { header {
// display: flex /*
// flex-wrap: wrap; * display: flex
* flex-wrap: wrap;
*/
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 15px 5px; padding: 15px 5px;
@ -87,6 +105,7 @@
chtml.site-wrapper({ chtml.site-wrapper({
chtml.site-container({ chtml.site-container({
html.nav({ html.nav({
if home != none { chtml.home-symbol(home) }
theme-picker() theme-picker()
if menu != none { nav-menu-toggle() } if menu != none { nav-menu-toggle() }
}) })

View file

@ -27,6 +27,8 @@
/// List of related sites for metadata /// List of related sites for metadata
me-links: (), me-links: (),
//-- Body -- //-- Body --
/// Home button, more or less expect an image in a link
home: none,
/// Navigation menu content, css style expect a list of links, but it can /// Navigation menu content, css style expect a list of links, but it can
/// be anything /// be anything
menu: none, menu: none,
@ -53,6 +55,7 @@
me-links: me-links me-links: me-links
) )
html_body( html_body(
home: home,
logo: logo, logo: logo,
header: header, header: header,
footer: footer, footer: footer,

View file

@ -6,8 +6,17 @@
description: "Test of the TTT template", description: "Test of the TTT template",
) )
#show: webpage.with( #show: webpage.with(
"http://test.example.com", "http://test.example.com",
home: link(
"http://test.example.com",
image(
"./platypus.png",
alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.",
height: 2em,
)
),
logo: image( logo: image(
"./platypus.png", "./platypus.png",
alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.", alt: "A drawing of a blue-ish round-ish platypus with big eyes, holding a laptop. This platypus is quite cute, but I might be biased.",