From b88a7d22c8d79b30de3403c631dd2c5f67669537 Mon Sep 17 00:00:00 2001 From: grm Date: Fri, 18 Sep 2026 19:17:17 +0300 Subject: Make the menu link styles switches that combine The one "Link style" select (normal, uppercase, plain) could not give uppercase links without the bold, or underlined bold links. Bold, uppercase and the underline (never, on hover, always) are now separate switches, drawn by blog.css from body classes (Theme.NavClass) so the theme CSS only colours the links. A stored nav_style is mapped onto the switches when the theme is read and dropped on the next save; themes without either keep the bold, underline-on-hover look blog.css always had. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Sd8UPWrvyYCLj97JexNw3A --- AGENTS.md | 10 ++++-- README.md | 4 +-- internal/i18n/el.go | 3 +- internal/web/static/blog.css | 7 +++-- internal/web/templates/dashboard/design.html | 10 +++--- internal/web/templates/layouts/blog.html | 2 +- internal/web/theme.go | 47 +++++++++++++++++++++++----- internal/web/web_test.go | 41 +++++++++++++++++++----- 8 files changed, 95 insertions(+), 29 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index dba6174..4689336 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -213,9 +213,13 @@ internal/web/ server.go (host router, middleware, render helpers) `ruled rule-` classes on the block, the `rule` template adds the `.header-rule` cells and blog.css draws them — table cells (so the rule is as tall as the brand and old browsers agree) in `currentColor`, i.e. the - header text colour; hidden on phones so a long title can wrap. `NavStyle` - `plain` is regular weight + underline for the menu links (blog.css makes - them bold). `TitleRule` (`none` | `line` | `dots` | `dots2` | `stripes`) is the header + header text colour; hidden on phones so a long title can wrap. The menu + links' look is switches that combine — `NavBold`, `NavUpper`, `NavUnderline` + (`hover` | `never` | `always`) — turned into body classes by + `Theme.NavClass` (`nav-bold nav-upper nav-ul-`) that blog.css draws; + the theme CSS only colours the links. They replaced a `nav_style` select + (`normal` | `uppercase` | `plain`), which `ParseTheme` still decodes and maps + onto the switches (`omitempty`, so the next save drops it). `TitleRule` (`none` | `line` | `dots` | `dots2` | `stripes`) is the header rule's kinds, plus a double dotted row (`dots2`: the border and an absolutely positioned `::after` with a second one 2px above), under page and post titles (`.page-title`, `.post-title`): a body class from `Theme.TitleRuleClass` (`titles-`) that blog.css draws diff --git a/README.md b/README.md index 84980bd..27919ef 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,8 @@ Server-rendered HTML, no JavaScript required, works on old browsers and phones. set number of pixels, centred or at the left; on phones the columns stack under the posts; the header and footer can follow the main column's edges for a centred, single-column look, and a rule (line, dots or stripes) can fill the - row beside the title or logo. The **menu** mixes blog pages and outside links, with - bold, uppercase or plain underlined links. Posts per + row beside the title or logo. The **menu** mixes blog pages and outside links; its + links can be bold, uppercase, underlined always, on hover or never, in any combination. Posts per page, the date format, the site title size and the footer alignment live here too, as does whether listings show whole posts or **summaries** with a "Read more" link (a post's summary ends at a `` line, or after its first paragraphs). diff --git a/internal/i18n/el.go b/internal/i18n/el.go index e2523cb..bdec8a2 100644 --- a/internal/i18n/el.go +++ b/internal/i18n/el.go @@ -388,9 +388,8 @@ var el = map[string]string{ "Medium": "Μεσαίο", "Tall": "Ψηλό", "menu in the header": "μενού στην κεφαλίδα", - "Link style": "Στυλ συνδέσμων", + "Underline": "Υπογράμμιση", "Uppercase, spaced": "Κεφαλαία, αραιά", - "Plain, underlined": "Απλοί, υπογραμμισμένοι", "Show the date on posts": "Εμφάνιση ημερομηνίας στις δημοσιεύσεις", "Show tags with a # in front": "Εμφάνιση των ετικετών με # μπροστά", "Rule under titles": "Γραμμή κάτω από τους τίτλους", diff --git a/internal/web/static/blog.css b/internal/web/static/blog.css index 8cd969e..054532d 100644 --- a/internal/web/static/blog.css +++ b/internal/web/static/blog.css @@ -28,8 +28,11 @@ img { max-width: 100%; height: auto; } .tagline { margin: 0.3em 0 0; opacity: 0.85; } .site-nav { border-bottom: 1px solid rgba(0,0,0,0.1); } .nav-inner { padding: 0.3em 1em; } -.site-nav a { display: inline-block; padding: 0.5em 0.8em; text-decoration: none; font-weight: bold; } -.site-nav a.active, .site-nav a:hover { text-decoration: underline; } +.site-nav a { display: inline-block; padding: 0.5em 0.8em; text-decoration: none; } +/* menu link styles (body.nav-*, from the theme's switches; colours are the theme CSS's) */ +.nav-bold .site-nav a { font-weight: bold; } +.nav-upper .site-nav a { text-transform: uppercase; letter-spacing: 0.05em; } +.nav-ul-always .site-nav a, .nav-ul-hover .site-nav a:hover, .site-nav a.active { text-decoration: underline; } .body-wrap { padding: 1.5em 1em; } .content { padding: 1.5em 2em; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.15); } .page-title { margin-top: 0; } diff --git a/internal/web/templates/dashboard/design.html b/internal/web/templates/dashboard/design.html index 476e311..7b11e44 100644 --- a/internal/web/templates/dashboard/design.html +++ b/internal/web/templates/dashboard/design.html @@ -155,14 +155,16 @@ - + +
diff --git a/internal/web/templates/layouts/blog.html b/internal/web/templates/layouts/blog.html index 29147e7..7ee0b54 100644 --- a/internal/web/templates/layouts/blog.html +++ b/internal/web/templates/layouts/blog.html @@ -12,7 +12,7 @@ {{$l := .Data.layout}} - + {{if or $l.Header .Data.theme.HeaderImage}}{{if .Data.theme.HeaderOn}}