Skip to content

Commit 951c883

Browse files
committed
add canonical extraction plugin
1 parent 21e5e0e commit 951c883

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

docs/css/style.css

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,59 @@
448448
isolation: isolate;
449449
}
450450
}
451+
.list {
452+
display: flex;
453+
flex-direction: column;
454+
font-size: 0.875rem;
455+
:where(.list-row) {
456+
--list-grid-cols: minmax(0, auto) 1fr;
457+
position: relative;
458+
display: grid;
459+
grid-auto-flow: column;
460+
gap: calc(0.25rem * 4);
461+
border-radius: var(--radius-box);
462+
padding: calc(0.25rem * 4);
463+
word-break: break-word;
464+
grid-template-columns: var(--list-grid-cols);
465+
&:has(.list-col-grow:nth-child(1)) {
466+
--list-grid-cols: 1fr;
467+
}
468+
&:has(.list-col-grow:nth-child(2)) {
469+
--list-grid-cols: minmax(0, auto) 1fr;
470+
}
471+
&:has(.list-col-grow:nth-child(3)) {
472+
--list-grid-cols: minmax(0, auto) minmax(0, auto) 1fr;
473+
}
474+
&:has(.list-col-grow:nth-child(4)) {
475+
--list-grid-cols: minmax(0, auto) minmax(0, auto) minmax(0, auto) 1fr;
476+
}
477+
&:has(.list-col-grow:nth-child(5)) {
478+
--list-grid-cols: minmax(0, auto) minmax(0, auto) minmax(0, auto) minmax(0, auto) 1fr;
479+
}
480+
&:has(.list-col-grow:nth-child(6)) {
481+
--list-grid-cols: minmax(0, auto) minmax(0, auto) minmax(0, auto) minmax(0, auto)
482+
minmax(0, auto) 1fr;
483+
}
484+
:not(.list-col-wrap) {
485+
grid-row-start: 1;
486+
}
487+
}
488+
& > :not(:last-child) {
489+
&.list-row, .list-row {
490+
&:after {
491+
content: "";
492+
border-bottom: var(--border) solid;
493+
inset-inline: var(--radius-box);
494+
position: absolute;
495+
bottom: calc(0.25rem * 0);
496+
border-color: var(--color-base-content);
497+
@supports (color: color-mix(in lab, red, red)) {
498+
border-color: color-mix(in oklab, var(--color-base-content) 5%, transparent);
499+
}
500+
}
501+
}
502+
}
503+
}
451504
.table {
452505
font-size: 0.875rem;
453506
position: relative;

plugins/extract-canonical.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- extract-canonical.lua
2+
canonical_link = HTML.select(page, "link[rel=\"canonical\"]")
3+
if Table.length(canonical_link) > 1 then
4+
Plugin.fail("Found more than one canoncial link, make sure there is not more than one canonical link")
5+
end
6+
canonical_link = canonical_link[1]
7+
if canonical_link == nil then
8+
Plugin.exit("No canonical link defined, nothing to do")
9+
end
10+
11+
head = HTML.select_one(page, "head")
12+
HTML.append_child(head, canonical_link)
13+
HTML.delete(excerpt, canonical_link)

soupault.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ section = "posts"
9696
[widgets.add-meta-description]
9797
widget = "add-meta-description"
9898

99+
[widgets.extract-canonical]
100+
widget = "extract-canonical"
101+
99102
[index]
100103
index = true
101104

0 commit comments

Comments
 (0)