diff --git a/TajikGanjoor/Pages/Index.cshtml b/TajikGanjoor/Pages/Index.cshtml index 9669195f..cfef39b5 100644 --- a/TajikGanjoor/Pages/Index.cshtml +++ b/TajikGanjoor/Pages/Index.cshtml @@ -86,26 +86,12 @@ } else if (Model.IsCatPage) { - - - @Model.GanjoorPage.PoetOrCat.Poet.Nickname - - @Model.GanjoorPage.PoetOrCat.Poet.Nickname -
@Html.Raw(Model.GanjoorPage.HtmlText)
} else if (Model.IsPoemPage) { - - - @Model.GanjoorPage.Poem.Category.Poet.Nickname - - @Model.GanjoorPage.Poem.Category.Poet.Nickname - @Html.Raw(Model.GanjoorPage.HtmlText) } else diff --git a/TajikGanjoor/Pages/Index.cshtml.cs b/TajikGanjoor/Pages/Index.cshtml.cs index a03b4145..c75f9b03 100644 --- a/TajikGanjoor/Pages/Index.cshtml.cs +++ b/TajikGanjoor/Pages/Index.cshtml.cs @@ -221,16 +221,28 @@ namespace TajikGanjoor.Pages if (IsPoetPage) { ViewData["Title"] = $"Ганҷур - {GanjoorPage?.PoetOrCat.Poet.Nickname}"; - BreadCrumpUrls += $" - {GanjoorPage?.PoetOrCat.Poet.Nickname}"; + BreadCrumpUrls += $" - \"\"{GanjoorPage?.PoetOrCat.Poet.Nickname}"; } else if (IsCatPage || IsPoemPage) { string title = $"Ганҷур - "; + bool firstAncestor = true; foreach (var gran in GanjoorPage.PoetOrCat.Cat.Ancestors) { title += $"{gran.Title} - "; - BreadCrumpUrls += $" - {gran.Title}"; + if (firstAncestor) + { + // Ancestors[0] is always the poet's own root category (see GanjoorService._GetCatById, + // which walks Parent all the way up) - prefix it with the poet's portrait instead of + // adding a separate crumb, so the image and the poet's name stay a single link. + BreadCrumpUrls += $" - \"\"{gran.Title}"; + firstAncestor = false; + } + else + { + BreadCrumpUrls += $" - {gran.Title}"; + } } title += GanjoorPage.PoetOrCat.Cat.Title; BreadCrumpUrls += $" - {GanjoorPage?.PoetOrCat.Cat.Title}"; diff --git a/TajikGanjoor/wwwroot/css/tajik-ganjoor.css b/TajikGanjoor/wwwroot/css/tajik-ganjoor.css index 18332b9a..016018b5 100644 --- a/TajikGanjoor/wwwroot/css/tajik-ganjoor.css +++ b/TajikGanjoor/wwwroot/css/tajik-ganjoor.css @@ -98,6 +98,11 @@ html, body { .tg-breadcrumb { font-family: 'PT Sans', sans-serif; font-size: 0.95rem; + display: flex; + flex-wrap: wrap; + align-items: center; + column-gap: 4px; + row-gap: 2px; } .tg-breadcrumb a:first-child { @@ -321,47 +326,26 @@ html, body { display: block; } -/* small inline poet badge, used above category pages and poem pages so - readers landing on a poem or a subcategory can still see whose work - it is at a glance, without the full bio-page header treatment */ -.tg-poet-badge { +/* small poet portrait inlined into the breadcrumb, prefixing the poet's + name wherever it appears there (poet page's own crumb, and the first + ancestor crumb on category/poem pages, which is always the poet's root + category - see Index.cshtml.cs) */ +.tg-crumb-poet { display: inline-flex; align-items: center; - gap: 8px; - margin: 4px auto 16px auto; - text-decoration: none; - color: var(--tg-ink-soft); + gap: 5px; + vertical-align: middle; } -.tg-poet-portrait-sm { - display: block; - width: 36px; - height: 36px; +.tg-crumb-poet img { + width: 22px; + height: 22px; border-radius: 50%; - overflow: hidden; - border: 2px solid var(--tg-rule); - background: #fff; - flex: 0 0 auto; -} - -.tg-poet-portrait-sm img { - width: 100%; - height: 100%; object-fit: cover; - display: block; -} - -.tg-poet-badge-name { - font-family: 'PT Serif', serif; - font-size: 0.95rem; -} - -.tg-poet-badge:hover .tg-poet-portrait-sm { - border-color: var(--tg-accent); -} - -.tg-poet-badge:hover .tg-poet-badge-name { - color: var(--tg-accent-deep); + border: 1px solid var(--tg-rule); + background: #fff; + vertical-align: middle; + flex: 0 0 auto; } /* GanjoorPage.HtmlText for poet/cat pages is server-generated plain