Ajoute les articles relatifs et harmonise la page 404
This commit is contained in:
24
config/_default/related.yaml
Normal file
24
config/_default/related.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
includeNewer: true
|
||||
threshold: 10
|
||||
toLower: true
|
||||
indices:
|
||||
- name: oeuvres
|
||||
weight: 120
|
||||
- name: franchises
|
||||
weight: 110
|
||||
- name: tags
|
||||
cardinalityThreshold: 5
|
||||
weight: 100
|
||||
- name: keywords
|
||||
cardinalityThreshold: 5
|
||||
weight: 90
|
||||
- name: genres
|
||||
weight: 80
|
||||
- name: personnages_de_fiction
|
||||
weight: 70
|
||||
- name: personnalites
|
||||
weight: 60
|
||||
- name: animaux
|
||||
weight: 20
|
||||
- name: entreprises
|
||||
weight: 20
|
||||
@@ -131,7 +131,7 @@ body > main:has(> article:first-child):has(> aside) > article:first-child {
|
||||
line-height: 1.85;
|
||||
}
|
||||
|
||||
body > main:has(> article:first-child):has(> aside) > article:first-child > :not(figure):not(table):not(pre):not(.highlight):not(section.article-books) {
|
||||
body > main:has(> article:first-child):has(> aside) > article:first-child > :not(figure):not(table):not(pre):not(.highlight):not(section.article-books):not(section.article-related) {
|
||||
max-width: 74ch;
|
||||
}
|
||||
|
||||
@@ -303,6 +303,146 @@ main > article li + li {
|
||||
margin-top: 0.35rem;
|
||||
}
|
||||
|
||||
main > article > section.article-related {
|
||||
margin-top: var(--space-6);
|
||||
border-top: 1px solid var(--color-border);
|
||||
padding-top: var(--space-4);
|
||||
}
|
||||
|
||||
main > article > section.article-related > header {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
main > article > section.article-related > header > h2 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding-top: 0;
|
||||
font-size: 1rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
main > article > section.article-related > header > h2::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list {
|
||||
--articles-related-flow-gap: 0.72rem;
|
||||
margin-top: var(--space-3);
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol {
|
||||
padding-left: 0;
|
||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li,
|
||||
main > article > section.article-related > nav.articles-list > ol > li + li {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list article {
|
||||
border-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > a {
|
||||
display: block;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > a > figure {
|
||||
margin: 0;
|
||||
min-height: 0;
|
||||
aspect-ratio: 340 / 191;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > a > figure img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > p {
|
||||
margin-top: var(--articles-related-flow-gap);
|
||||
font-size: 0.78rem;
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > p > a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
font-family: var(--font-heading);
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > p > a:is(:hover, :focus-visible) {
|
||||
color: var(--color-link-hover);
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > h3 {
|
||||
margin-top: var(--articles-related-flow-gap);
|
||||
margin-bottom: 0;
|
||||
padding-top: 0;
|
||||
position: static;
|
||||
font-size: clamp(1rem, 1.5vw, 1.12rem);
|
||||
line-height: 1.15;
|
||||
text-transform: none;
|
||||
letter-spacing: 0.01em;
|
||||
color: var(--color-heading);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > h3::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header > h3 > a {
|
||||
color: var(--color-heading);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list > ol > li article > header:has(> p) > h3 {
|
||||
margin-top: calc(var(--articles-related-flow-gap) * 0.4);
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list article > p:nth-of-type(1) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list article > p:last-child {
|
||||
margin-top: var(--articles-related-flow-gap);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1);
|
||||
font-size: 0.76rem;
|
||||
color: var(--color-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
font-family: var(--font-heading);
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list article > p:last-child > a {
|
||||
color: inherit;
|
||||
text-decoration: underline;
|
||||
text-decoration-thickness: 1px;
|
||||
text-underline-offset: 0.15em;
|
||||
}
|
||||
|
||||
main > article > section.article-related > nav.articles-list article > p:last-child > a:is(:hover, :focus-visible) {
|
||||
color: inherit;
|
||||
filter: brightness(1.2);
|
||||
}
|
||||
|
||||
main > article > footer.article-footer {
|
||||
margin-top: var(--space-6);
|
||||
border-top: 1px solid var(--color-border);
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
{{ define "main" }}
|
||||
{{- $recentPages := first 6 (site.RegularPages.ByDate.Reverse) -}}
|
||||
<header>
|
||||
{{ partialCached "header-brand.html" .Site .Site.Title (.Site.Params.logo | default "logo-large.png") }}
|
||||
<h1>Page introuvable</h1>
|
||||
</header>
|
||||
{{- $recentPages := slice -}}
|
||||
{{- range site.RegularPages.ByDate.Reverse -}}
|
||||
{{- if and .Params.date (lt (len $recentPages) 8) -}}
|
||||
{{- $recentPages = $recentPages | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ partial "article-header.html" (dict
|
||||
"Page" .
|
||||
"Title" "Page introuvable"
|
||||
"ShowMeta" false
|
||||
) }}
|
||||
<main>
|
||||
<article>
|
||||
<p>Le contenu que vous recherchez n'existe pas.</p>
|
||||
@@ -11,9 +17,19 @@
|
||||
</article>
|
||||
|
||||
{{ if gt (len $recentPages) 0 }}
|
||||
<section>
|
||||
<header><h2>Derniers articles</h2></header>
|
||||
{{ partial "articles-list.html" (dict "Pages" $recentPages "Context" .) }}
|
||||
<section class="listing-spotlight">
|
||||
<header>
|
||||
<h2>Derniers articles</h2>
|
||||
</header>
|
||||
{{ partial "spotlight-block.html" (dict
|
||||
"Cards" $recentPages
|
||||
"FeedPages" $recentPages
|
||||
"FeedTitle" "Derniers articles"
|
||||
"ShowFeedTitle" false
|
||||
"FeedRich" true
|
||||
"ShowSection" true
|
||||
"AsideFirst" false
|
||||
) }}
|
||||
</section>
|
||||
{{ end }}
|
||||
</main>
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
{{- $page := .Page -}}
|
||||
{{- $coverPath := .Params.cover -}}
|
||||
{{- $isInterestingLink := strings.HasPrefix .RelPermalink "/interets/liens-interessants/" -}}
|
||||
{{- $page := . -}}
|
||||
{{- $title := .Title -}}
|
||||
{{- $showMeta := true -}}
|
||||
{{- if reflect.IsMap . -}}
|
||||
{{- with index . "Page" -}}
|
||||
{{- $page = . -}}
|
||||
{{- end -}}
|
||||
{{- with index . "Title" -}}
|
||||
{{- $title = . -}}
|
||||
{{- end -}}
|
||||
{{- if isset . "ShowMeta" -}}
|
||||
{{- $showMeta = index . "ShowMeta" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $coverPath := $page.Params.cover -}}
|
||||
{{- $isInterestingLink := strings.HasPrefix $page.RelPermalink "/interets/liens-interessants/" -}}
|
||||
{{- $showCover := and $coverPath (not $isInterestingLink) -}}
|
||||
{{- $linksParam := .Params.links -}}
|
||||
{{- $linksParam := $page.Params.links -}}
|
||||
{{- $links := slice -}}
|
||||
{{- if $linksParam -}}
|
||||
{{- $type := printf "%T" $linksParam -}}
|
||||
@@ -105,17 +119,17 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $coverImageTitle := default .Title (index $coverData "title") -}}
|
||||
{{- $coverImageTitle := default $title (index $coverData "title") -}}
|
||||
{{- $coverTitle := index $coverData "title" -}}
|
||||
{{- $coverDescription := index $coverData "description" -}}
|
||||
{{- $coverAttribution := index $coverData "attribution" -}}
|
||||
{{- $coverPrompt := index $coverData "prompt" -}}
|
||||
{{- $weather := .Params.weather -}}
|
||||
{{- $weather := $page.Params.weather -}}
|
||||
{{- $weatherIcon := "" -}}
|
||||
{{- $weatherLabel := "Météo" -}}
|
||||
{{- $weatherTitle := "" -}}
|
||||
{{- if and $weather (gt (len $weather) 0) -}}
|
||||
{{- $hour := (time .Date).Hour -}}
|
||||
{{- $hour := (time $page.Date).Hour -}}
|
||||
{{- $isNight := false -}}
|
||||
{{- if or (lt $hour 6) (ge $hour 18) -}}
|
||||
{{- $isNight = true -}}
|
||||
@@ -169,15 +183,15 @@
|
||||
{{- end -}}
|
||||
{{- $hasCoverImage := and $showCover $coverImage -}}
|
||||
{{- $hasCoverMeta := or $coverTitle $coverDescription $coverAttribution $coverPrompt -}}
|
||||
{{- $showReadingTime := ge .ReadingTime 5 -}}
|
||||
{{- $showReadingTime := ge $page.ReadingTime 5 -}}
|
||||
{{- $hasPublication := or $showReadingTime $hasWeatherIcon -}}
|
||||
{{- with .Date -}}
|
||||
{{- with $page.Date -}}
|
||||
{{- $hasPublication = true -}}
|
||||
{{- end -}}
|
||||
{{- $breadcrumbsMarkup := partial "breadcrumbs.html" . -}}
|
||||
{{- $breadcrumbsMarkup := partial "breadcrumbs.html" $page -}}
|
||||
{{- $hasBreadcrumbs := ne (strings.TrimSpace $breadcrumbsMarkup) "" -}}
|
||||
{{- $pageLinksMarkup := partial "page-links.html" (dict
|
||||
"Page" .
|
||||
"Page" $page
|
||||
"LinkClass" "ui-button"
|
||||
"Links" $remainingLinks
|
||||
) -}}
|
||||
@@ -185,11 +199,11 @@
|
||||
{{- $hasOriginCallout := and $isInterestingLink (ne $originURL "") -}}
|
||||
{{- $hasMetaMain := or $hasBreadcrumbs $hasPublication $hasPageLinks $hasOriginCallout -}}
|
||||
{{- $showCoverMeta := and (not $isInterestingLink) $coverPath $hasCoverMeta -}}
|
||||
{{- $hasMetaBlock := or $hasCoverImage $hasMetaMain $showCoverMeta -}}
|
||||
{{- $hasMetaBlock := and $showMeta (or $hasCoverImage $hasMetaMain $showCoverMeta) -}}
|
||||
|
||||
<header class="article-header{{ if $isInterestingLink }} article-header--interesting-link{{ end }}">
|
||||
{{ partialCached "header-brand.html" .Site .Site.Title (.Site.Params.logo | default "logo-large.png") }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ partialCached "header-brand.html" $page.Site $page.Site.Title ($page.Site.Params.logo | default "logo-large.png") }}
|
||||
<h1>{{ $title }}</h1>
|
||||
|
||||
{{- if $hasMetaBlock -}}
|
||||
<section class="article-meta-block{{ if not $hasCoverImage }} article-meta-block--without-cover{{ end }}">
|
||||
@@ -209,7 +223,7 @@
|
||||
|
||||
{{- if $hasPublication -}}
|
||||
<p class="article-publication">
|
||||
{{ with .Date }}
|
||||
{{ with $page.Date }}
|
||||
{{- $timePart := . | time.Format "15:04:05" -}}
|
||||
<time datetime="{{ . }}">
|
||||
{{- if eq $timePart "00:00:00" -}}
|
||||
@@ -228,7 +242,7 @@
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
{{- if $showReadingTime -}}
|
||||
<span>{{ .ReadingTime }} min de lecture</span>
|
||||
<span>{{ $page.ReadingTime }} min de lecture</span>
|
||||
{{- end -}}
|
||||
</p>
|
||||
{{- end -}}
|
||||
@@ -244,7 +258,7 @@
|
||||
"Title" "Lire la page d'origine"
|
||||
"Text" $originLinkText
|
||||
"Class" "ui-button article-origin-link-button-link"
|
||||
"Page" .
|
||||
"Page" $page
|
||||
) -}}
|
||||
</p>
|
||||
</section>
|
||||
@@ -266,7 +280,7 @@
|
||||
{{- end -}}
|
||||
{{- with $coverAttribution -}}
|
||||
{{- $attribution := partial "media/parse-attribution.html" . -}}
|
||||
<p class="cover-attribution"><strong>Attribution:</strong> <span>{{- if index $attribution "isURL" -}}{{ partial "render/link.html" (dict "Destination" (index $attribution "url") "Page" $ "Text" (index $attribution "label")) }}{{- else -}}{{ . | markdownify }}{{- end -}}</span></p>
|
||||
<p class="cover-attribution"><strong>Attribution:</strong> <span>{{- if index $attribution "isURL" -}}{{ partial "render/link.html" (dict "Destination" (index $attribution "url") "Page" $page "Text" (index $attribution "label")) }}{{- else -}}{{ . | markdownify }}{{- end -}}</span></p>
|
||||
{{- end -}}
|
||||
{{- with $coverPrompt -}}
|
||||
<details>
|
||||
|
||||
53
themes/2026/layouts/_partials/article-related.html
Normal file
53
themes/2026/layouts/_partials/article-related.html
Normal file
@@ -0,0 +1,53 @@
|
||||
{{- $excludePrefix := "interets/liens-interessants/" -}}
|
||||
{{- $excludeCurrent := false -}}
|
||||
{{- $currentHasDate := false -}}
|
||||
{{- with .File -}}
|
||||
{{- if strings.HasPrefix .Path $excludePrefix -}}
|
||||
{{- $excludeCurrent = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Params.date -}}
|
||||
{{- $currentHasDate = true -}}
|
||||
{{- end -}}
|
||||
{{- if not $currentHasDate -}}
|
||||
{{- $excludeCurrent = true -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $excludeCurrent -}}
|
||||
{{- $related := site.RegularPages.Related . -}}
|
||||
{{- $items := slice -}}
|
||||
{{- range $related -}}
|
||||
{{- $excludeCandidate := false -}}
|
||||
{{- $sameDossier := false -}}
|
||||
{{- $candidateHasDate := false -}}
|
||||
{{- with .File -}}
|
||||
{{- if strings.HasPrefix .Path $excludePrefix -}}
|
||||
{{- $excludeCandidate = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Params.date -}}
|
||||
{{- $candidateHasDate = true -}}
|
||||
{{- end -}}
|
||||
{{- if gt (len (intersect (default (slice) $.Params.dossier) (default (slice) .Params.dossier))) 0 -}}
|
||||
{{- $sameDossier = true -}}
|
||||
{{- end -}}
|
||||
{{- if and $candidateHasDate (not $excludeCandidate) (not $sameDossier) (ne .RelPermalink $.RelPermalink) -}}
|
||||
{{- $items = $items | append . -}}
|
||||
{{- end -}}
|
||||
{{- if ge (len $items) 3 -}}
|
||||
{{- break -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if gt (len $items) 0 -}}
|
||||
<section class="article-related">
|
||||
<header>
|
||||
<h2>Articles relatifs</h2>
|
||||
</header>
|
||||
{{- partial "articles-list.html" (dict
|
||||
"Pages" $items
|
||||
"ShowDossierBeforeTitle" true
|
||||
) -}}
|
||||
</section>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -5,6 +5,7 @@
|
||||
{{ .Content }}
|
||||
{{ partial "article-books.html" . }}
|
||||
{{ partial "article-asides.html" . }}
|
||||
{{ partial "article-related.html" . }}
|
||||
{{ partial "article-footer.html" . }}
|
||||
</article>
|
||||
{{ partial "asides/complementary-images.html" . }}
|
||||
|
||||
Reference in New Issue
Block a user