mattjennings / sveltekit-blog-template

A SvelteKit blog template
https://sveltekit-blog-template.vercel.app
MIT License
229 stars 35 forks source link

Add custom preview as a new feature #7

Closed metters closed 2 years ago

metters commented 2 years ago

Hey,

I started to use your template today. Thanks for the great work. I did not like the content of the preview for one post of mine, because the first paragraph was not suitable for a preview. So I added this as additional feature.

Usage

Add the property preview to the metadata of the post.

Example of how to add a custom preview in the markdown file metadata

---
title: Lorem Ipsum!
date: 2022-02-11
preview: This is a custom preview. I now can optionally add content or thoughts from other paragraphs than just the first one. Or I can edit the first paragraph so it makes a better preview than the actual content.
---

Hope you like the idea. If I should change anything please let me know or simply reject this PR.

Rendered result of the post with Lorem Ipsum without the custom preview text

Screenshot 2022-02-11 at 19 53 52 Screenshot 2022-02-11 at 19 54 00
metters commented 2 years ago

If requested I can also document this new behaviour in the getting started post.

mattjennings commented 2 years ago

This is a great idea, thanks for making the PR! If you could add something to the getting started post that would be awesome.

metters commented 2 years ago

Done. Feel free to suggest different text to document the preview property, I am not a native speaker.