more prominent related pages
This commit is contained in:
parent
22b530c26d
commit
6286c82389
|
|
@ -94,6 +94,7 @@ applyAuthorRules authors baseCtx = tagsRules authors $ \name pat -> do
|
|||
<> paginateContext paginate pageNum
|
||||
<> constField "author" name
|
||||
<> constField "title" name
|
||||
<> constField "portal" "true"
|
||||
<> baseCtx
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/author-index.html" ctx
|
||||
|
|
|
|||
|
|
@ -409,6 +409,7 @@ photographyMapPageRule =
|
|||
let ctx = constField "title" "Map · Photography"
|
||||
<> constField "photography" "true"
|
||||
<> constField "photography-map" "true"
|
||||
<> constField "portal" "true"
|
||||
<> siteCtx
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/photography-map.html" ctx
|
||||
|
|
@ -589,6 +590,7 @@ photographyContactSheetRule =
|
|||
listField "photos" photographyCtx (return photos)
|
||||
<> constField "title" "Contact sheet · Photography"
|
||||
<> constField "photography" "true"
|
||||
<> constField "portal" "true"
|
||||
<> siteCtx
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate
|
||||
|
|
|
|||
|
|
@ -543,6 +543,7 @@ rules = do
|
|||
let ctx =
|
||||
listField "essays" essayCtx (return essays)
|
||||
<> constField "title" "Essays"
|
||||
<> constField "portal" "true"
|
||||
<> siteCtx
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/essay-index.html" ctx
|
||||
|
|
@ -712,6 +713,7 @@ rules = do
|
|||
<> libraryIntroFld
|
||||
<> constField "title" "Library"
|
||||
<> constField "library" "true"
|
||||
<> constField "portal" "true"
|
||||
<> siteCtx
|
||||
|
||||
makeItem ""
|
||||
|
|
@ -788,6 +790,7 @@ rules = do
|
|||
<> constField "bibliography-index" "true"
|
||||
<> constField "bibliography-entries" (T.unpack html)
|
||||
<> constField "library" "true" -- reuse flag to load library.css + item-card.css
|
||||
<> constField "portal" "true"
|
||||
<> siteCtx
|
||||
makeItem ""
|
||||
>>= loadAndApplyTemplate "templates/bibliography-index.html" ctx
|
||||
|
|
|
|||
|
|
@ -1114,36 +1114,46 @@ nav.site-nav {
|
|||
}
|
||||
|
||||
/* ============================================================
|
||||
RELATED (SIMILAR LINKS) — compact vertical list of up to 3 titles.
|
||||
Source file: data/similar-links.json (produced by tools/embed.py).
|
||||
RELATED (SIMILAR LINKS) — promoted to a full-width aftermatter
|
||||
section, sitting just under Backlinks. Source file:
|
||||
data/similar-links.json (produced by tools/embed.py).
|
||||
============================================================ */
|
||||
|
||||
#similar-links .similar-links-list {
|
||||
.meta-footer-similar > h3 {
|
||||
font-size: 1.05rem;
|
||||
letter-spacing: 0.09em;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.meta-footer-similar .similar-links-list {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
gap: 0.55rem;
|
||||
}
|
||||
|
||||
#similar-links .similar-links-list li::before {
|
||||
.meta-footer-similar .similar-links-list li::before {
|
||||
content: none;
|
||||
}
|
||||
|
||||
#similar-links .similar-links-item a {
|
||||
.meta-footer-similar .similar-links-item a {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 0.92rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 1.18rem;
|
||||
font-weight: 500;
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid transparent;
|
||||
border-bottom: 1px solid var(--border-muted);
|
||||
padding-bottom: 0.05em;
|
||||
transition: color var(--transition-fast),
|
||||
border-color var(--transition-fast);
|
||||
}
|
||||
|
||||
#similar-links .similar-links-item a:hover {
|
||||
.meta-footer-similar .similar-links-item a:hover,
|
||||
.meta-footer-similar .similar-links-item a:focus-visible {
|
||||
color: var(--text);
|
||||
border-bottom-color: var(--border-muted);
|
||||
border-bottom-color: var(--border);
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
|
|
|
|||
|
|
@ -11,23 +11,19 @@
|
|||
$backlinks$
|
||||
</div>
|
||||
$if(similar-links)$
|
||||
<div class="meta-footer-grid">
|
||||
<div class="meta-footer-section" id="similar-links">
|
||||
<div class="meta-footer-full meta-footer-similar" id="similar-links">
|
||||
<h3>Related</h3>
|
||||
$similar-links$
|
||||
</div>
|
||||
</div>
|
||||
$endif$
|
||||
</footer>
|
||||
$else$
|
||||
$if(similar-links)$
|
||||
<footer class="page-meta-footer">
|
||||
<div class="meta-footer-grid">
|
||||
<div class="meta-footer-section" id="similar-links">
|
||||
<div class="meta-footer-full meta-footer-similar" id="similar-links">
|
||||
<h3>Related</h3>
|
||||
$similar-links$
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
$endif$
|
||||
$endif$
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
$partial("templates/partials/head.html")$
|
||||
</head>
|
||||
<body$if(reading)$ class="reading-mode$if(poetry)$ poetry$endif$$if(fiction)$ fiction$endif$"$endif$$if(photography)$ data-page-type="photography"$endif$$if(dingbat)$ data-dingbat="$dingbat$"$endif$>
|
||||
<body$if(reading)$ class="reading-mode$if(poetry)$ poetry$endif$$if(fiction)$ fiction$endif$"$endif$$if(photography)$ data-page-type="photography"$endif$$if(dingbat)$ data-dingbat="$dingbat$"$endif$$if(list-page)$ data-portal$endif$$if(portal)$ data-portal$endif$$if(home)$ data-portal$endif$>
|
||||
<a class="skip-link" href="#markdownBody">Skip to content</a>
|
||||
$partial("templates/partials/nav.html")$
|
||||
$if(search)$
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
$if(status)$<a href="#epistemic">Epistemic</a>$endif$
|
||||
$if(bibliography)$<a href="#bibliography">Bibliography</a>$endif$
|
||||
$if(backlinks)$<a href="#backlinks">Backlinks</a>$endif$
|
||||
$if(similar-links)$<a href="#similar-links">Related</a>$endif$
|
||||
$if(repository)$<a href="$repository$">Repository</a>$endif$
|
||||
$if(preprint)$<a href="$preprint$">Preprint</a>$endif$
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -64,15 +64,15 @@
|
|||
</div>
|
||||
$endif$
|
||||
|
||||
<div class="meta-footer-grid">
|
||||
|
||||
$if(similar-links)$
|
||||
<div class="meta-footer-section" id="similar-links">
|
||||
<div class="meta-footer-full meta-footer-similar" id="similar-links">
|
||||
<h3>Related</h3>
|
||||
$similar-links$
|
||||
</div>
|
||||
$endif$
|
||||
|
||||
<div class="meta-footer-grid">
|
||||
|
||||
$if(status)$
|
||||
<div class="meta-footer-section meta-footer-epistemic" id="epistemic">
|
||||
<h3><a href="/colophon.html#living-documents">Epistemic</a></h3>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
|
@ -46,6 +46,14 @@ MAX_PARA_CHARS = 1000 # semantic: truncate before embedding
|
|||
|
||||
EXCLUDE_URLS = {"/search/", "/build/", "/404.html", "/feed.xml", "/music/feed.xml"}
|
||||
|
||||
# Pages whose <body data-portal> are portal/landing pages — they aggregate
|
||||
# excerpts from many entries and would otherwise dominate every page's
|
||||
# "Related" set with high but uninformative scores. default.html sets the
|
||||
# attribute when any of the `list-page`, `portal`, or `home` template flags
|
||||
# is true, so adding `constField "portal" "true"` to a Hakyll rule (or
|
||||
# `portal: true` to a content file's frontmatter) is enough to exclude it.
|
||||
PORTAL_BODY_ATTR = "data-portal"
|
||||
|
||||
|
||||
def atomic_write_bytes(path: Path, data: bytes) -> None:
|
||||
"""Write to path.tmp then os.replace, so an interrupt mid-write
|
||||
|
|
@ -112,6 +120,9 @@ def extract_page(html_path: Path) -> dict | None:
|
|||
|
||||
if url in EXCLUDE_URLS:
|
||||
return None
|
||||
body_tag = soup.body
|
||||
if body_tag is not None and body_tag.has_attr(PORTAL_BODY_ATTR):
|
||||
return None
|
||||
body = soup.select_one("#markdownBody")
|
||||
if body is None:
|
||||
return None
|
||||
|
|
|
|||
Loading…
Reference in New Issue