Skip to content

Commit

Permalink
[WIP] Start trying to show a snippet instead of description. Not work…
Browse files Browse the repository at this point in the history
…ing. WIP.
  • Loading branch information
ewels committed Mar 15, 2024
1 parent 9cd2b1f commit 53d2f01
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 2 deletions.
14 changes: 13 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from "astro/config";

import remarkDescription from "astro-remark-description";
import sitemap from "@astrojs/sitemap";

// https://astro.build/config
Expand All @@ -12,6 +12,18 @@ export default defineConfig({
// https://shiki.style/themes
theme: "light-plus",
},
remarkPlugins: [
[
remarkDescription,
{
name: "excerpt",
node: (node, i, parent) => {
const sibling = parent?.children[i + 1];
return sibling?.type === "html" && sibling?.value === "<!-- end-archive-description -->";
},
},
],
],
},
integrations: [
sitemap({
Expand Down
76 changes: 76 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"astro": "^4.4.15",
"astro-remark-description": "^1.1.2",
"typescript": "^5.4.2"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const posts = (await getCollection("blog")).sort(
</li>
</ul>
<hr />
<p class="blg-text">{post.data.description}</p>
<p class="blg-text">
<pre>{JSON.stringify(post.data, null, 2)}</pre>
</p>
</section>
);
})
Expand Down

0 comments on commit 53d2f01

Please sign in to comment.