Skip to content

Commit

Permalink
Fix page
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatekii committed May 16, 2024
1 parent 0d5614e commit 2c01f6b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
4 changes: 1 addition & 3 deletions _config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import sass from "lume/plugins/sass.ts";
import source_maps from "lume/plugins/source_maps.ts";
import svgo from "lume/plugins/svgo.ts";
import toc from "https://deno.land/x/[email protected]/toc/mod.ts";
import readingTime from "https://raw.githubusercontent.com/lumeland/experimental-plugins/main/reading_time/mod.ts";
import { Page } from "lume/core.ts";

const markdown = {
Expand Down Expand Up @@ -56,7 +55,6 @@ site.use(imagick());
site.use(sass());
site.use(source_maps());
site.use(svgo());
site.use(readingTime());
site
.scopedUpdates((path) => path.endsWith(".png") || path.endsWith(".jpg"))
.filter("slice", (arr, length) => arr.slice(0, length))
Expand Down Expand Up @@ -109,7 +107,7 @@ site
})
.preprocess([".md"], (page: Page) => {
page.data.excerpt ??= (page.data.content as string).split(
/<!--\s*more\s*-->/i,
/<!--\s*more\s*-->/i
)[0];
});

Expand Down
37 changes: 19 additions & 18 deletions src/_includes/templates/post-details.jsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
export default (
{ search, authors, date, readingTime, filters },
) => {
export default ({ search, authors, date, readingTime, filters }) => {
const page = search.page(`type=author author="author"`);
return (
<div className="post-details">
<p>
by {authors.map((author, i) => ((
by{" "}
{authors.map((author, i) => (
<>
{page
? (
<a data-pagefind-filter="author" href={page.data.url}>
{author}
</a>
)
: author}
{page ? (
<a data-pagefind-filter="author" href={page.data.url}>
{author}
</a>
) : (
author
)}
{authors.length == 2
? (i == authors.length - 1 ? "" : " and ")
: (authors.length > 2
? (i == authors.length - 1 ? "" : ", ")
: "")}
? i == authors.length - 1
? ""
: " and "
: authors.length > 2
? i == authors.length - 1
? ""
: ", "
: ""}
</>
)))}
))}
</p>
<p>
<time dateTime={filters.date(date, "DATETIME")}>
{filters.date(date, "HUMAN_DATE")}
</time>
</p>

<p>{readingTime.minutes} min read</p>
</div>
);
};

0 comments on commit 2c01f6b

Please sign in to comment.