Shorten your Summary: The 2 Methods

If you are anything like me and blog about code a lot, you will sometimes want to start with a short paragraph, then straight into some code. Like this:

1
echo "Hello World"

Problem: But if you do this, then the .Summary data on your list will look like this (notice the line number and code in it):

example of bad summary

When perhaps you would like it to look like this (free of code):

example of good summary

Solution 1) The More Comment

When you are all finished, add a more html comment to signify where the summary should end. This is similar to in other CMS, like Wordpress.

Note: This must not contain spaces

1
2
3
4
5
6
7
8
---
title: Example Post
type: post
date: 1970-01-01T00:00:00+00:00
url: /example-post/
---
My Summary<!--more-->
More content

Summary Output:

1
My Summary

Solution 2) Manual Summary (To Override)

The second option takes matters into your own hands, we can specify our own summary. To do this, within the header of our post we can make a “Summary” and enter text there.

1
2
3
4
5
6
7
8
---
title: Example Post
type: post
date: 1970-01-01T00:00:00+00:00
url: /example-post/
summary: Completely different summary text.
---
How I start my post

Summary Output:

1
Completely different summary text.

Hopefully you found what you were after by reading this post. Let us know in the comments if you have any issues.