Skip to content

Commit 7d784b3

Browse files
committed
add config option 'feed_show_excerpt
1 parent fcddc9e commit 7d784b3

File tree

5 files changed

+93
-64
lines changed

5 files changed

+93
-64
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ One of the major changes in this version is that a lot of time was spent on reth
1111
- Added `before-content` and `after-content` YAML options that allow you to add some common HTML before the main content of a page (below the title) or after the main content (above the footer). Works in a similar way to `footer-extra`.
1212
- Added `head-extra` YAML option which i s similar to `footer-extra` but is used to include custom HTML code in a page's `<head>` tag
1313
- Added `full-width` YAML option to allow having full-width pages
14+
- Added `feed_show_excerpt` config option to show/hide the post excerpts on the feed page
1415
- Improved the `footer-extra` YAML option to support multiple files instead of only a single file
1516
- Upgraded jQuery to version 3.5.1 to fix a couple security vulnerabilities with the previous version
1617
- Added automatic navbar color detection (#702)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ Beautiful Jekyll is, and always will be, free. But if you want to remove the Bea
8989

9090
# Add your own content
9191

92-
To add pages to your site, you can either write a markdown file (`.md`) or you can write an HTML file. It's much easier to write markdown than HTML, so I suggest you do that ([here's a great tutorial](https://markdowntutorial.com/) if you need to learn markdown in 5 minutes). You can look at some files on this demo site to get an idea of how to write markdown.
92+
To add pages to your site, you can either write a markdown file (`.md`) or you can write an HTML file. It's much easier to write markdown than HTML, so I suggest you do that ([here's a great tutorial](https://markdowntutorial.com/) if you need to learn markdown in 5 minutes).
9393

94-
To look at existing files, click on any file that ends in `.md`, for example [`aboutme.md`](./aboutme.md). On the next page you can see some nicely formatted text (there's a word in bold, a link, a few bullet points), and if you click on the pencil icon to edit the file, you'll see the markdown code that generated the pretty text. Very easy!
94+
To see an example of a markdown file, click on any file that ends in `.md`, for example [`aboutme.md`](./aboutme.md). On that page you can see some nicely formatted text (there's a word in bold, a link, a few bullet points), and if you click on the pencil icon to edit the file, you'll see the markdown code that generated the pretty text. Very easy!
9595

9696
In contrast, look at [`tags.html`](./tags.html). That's how your write HTML - not as pretty. So stick with markdown if you don't know HTML.
9797

_config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ url-pretty: "MyWebsite.com"
7676
# Excerpt word length - Truncate the excerpt of each post on the feed page to the specified number of words
7777
excerpt_length: 50
7878

79+
# Whether or not to show an excerpt for every blog post in the feed page
80+
feed_show_excerpt: true
81+
7982
# The keywords to associate with your website, for SEO purposes
8083
#keywords: "my,list,of,keywords"
8184

@@ -167,7 +170,6 @@ date_format: "%B %-d, %Y"
167170
# Facebook App ID
168171
#fb_app_id: ""
169172

170-
171173
# --- You don't need to touch anything below here (but you can if you want) --- #
172174

173175
# Output options (more information on Jekyll's site)

_layouts/home.html

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@
99
<div class="posts-list">
1010
{% for post in posts %}
1111
<article class="post-preview">
12+
13+
{%- capture thumbnail -%}
14+
{% if post.thumbnail-img %}
15+
{{ post.thumbnail-img }}
16+
{% elsif post.cover-img %}
17+
{% if post.cover-img.first %}
18+
{{ post.cover-img[0].first.first }}
19+
{% else %}
20+
{{ post.cover-img }}
21+
{% endif %}
22+
{% else %}
23+
{% endif %}
24+
{% endcapture %}
25+
{% assign thumbnail=thumbnail | strip %}
26+
27+
{% if site.feed_show_excerpt == false %}
28+
{% if thumbnail != "" %}
29+
<div class="post-image post-image-normal">
30+
<a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
31+
<img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
32+
</a>
33+
</div>
34+
{% endif %}
35+
{% endif %}
36+
1237
<a href="{{ post.url | absolute_url }}">
1338
<h2 class="post-title">{{ post.title }}</h2>
1439

@@ -24,36 +49,32 @@ <h3 class="post-subtitle">
2449
Posted on {{ post.date | date: date_format }}
2550
</p>
2651

27-
<div class="post-entry-container">
28-
{%- capture thumbnail -%}
29-
{% if post.thumbnail-img %}
30-
{{ post.thumbnail-img }}
31-
{% elsif post.cover-img %}
32-
{% if post.cover-img.first %}
33-
{{ post.cover-img[0].first.first }}
34-
{% else %}
35-
{{ post.cover-img }}
36-
{% endif %}
37-
{% else %}
38-
{% endif %}
39-
{% endcapture %}
40-
{% assign thumbnail=thumbnail | strip %}
41-
{% if thumbnail != "" %}
42-
<div class="post-image">
43-
<a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
44-
<img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
45-
</a>
46-
</div>
52+
{% if thumbnail != "" %}
53+
<div class="post-image post-image-small">
54+
<a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
55+
<img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
56+
</a>
57+
</div>
58+
{% endif %}
59+
60+
{% unless site.feed_show_excerpt == false %}
61+
{% if thumbnail != "" %}
62+
<div class="post-image post-image-short">
63+
<a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
64+
<img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
65+
</a>
66+
</div>
67+
{% endif %}
68+
69+
<div class="post-entry">
70+
{% assign excerpt_length = site.excerpt_length | default: 50 %}
71+
{{ post.excerpt | strip_html | xml_escape | truncatewords: excerpt_length }}
72+
{% assign excerpt_word_count = post.excerpt | number_of_words %}
73+
{% if post.content != post.excerpt or excerpt_word_count > excerpt_length %}
74+
<a href="{{ post.url | absolute_url }}" class="post-read-more">[Read&nbsp;More]</a>
4775
{% endif %}
48-
<div class="post-entry">
49-
{% assign excerpt_length = site.excerpt_length | default: 50 %}
50-
{{ post.excerpt | strip_html | xml_escape | truncatewords: excerpt_length }}
51-
{% assign excerpt_word_count = post.excerpt | number_of_words %}
52-
{% if post.content != post.excerpt or excerpt_word_count > excerpt_length %}
53-
<a href="{{ post.url | absolute_url }}" class="post-read-more">[Read&nbsp;More]</a>
54-
{% endif %}
55-
</div>
5676
</div>
77+
{% endunless %}
5778

5879
{% if post.tags.size > 0 %}
5980
<div class="blog-tags">

assets/css/beautifuljekyll.css

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ footer .footer-custom-content {
447447

448448
.post-preview a {
449449
text-decoration: none;
450+
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
450451
color: {{ site.text-col | default: "#404040" }};
451452
}
452453

@@ -471,13 +472,7 @@ footer .footer-custom-content {
471472
font-size: 1.125rem;
472473
font-style: italic;
473474
margin: 0 0 0.625rem;
474-
}
475-
.post-preview .post-entry {
476-
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
477-
}
478-
.post-entry-container {
479-
display: inline-block;
480-
width: 100%;
475+
font-family: 'Lora', 'Times New Roman', serif;
481476
}
482477
.post-entry {
483478
width: 100%;
@@ -487,17 +482,49 @@ footer .footer-custom-content {
487482
margin-left: 0.625rem;
488483
height: 12rem;
489484
width: 12rem;
490-
margin-top: -2.1875rem;
485+
}
486+
.post-image {
491487
filter: grayscale(90%);
492488
}
493489
.post-image:hover {
494490
filter: grayscale(0%);
495491
}
496492
.post-image img {
497-
border-radius: 6.25rem;
498-
height: 12rem;
499-
width: 12rem;
493+
border-radius: 6rem;
494+
height: 100%;
495+
width: 100%;
500496
}
497+
.post-image-short {
498+
margin-top: -2.1875rem;
499+
}
500+
@media (max-width: 767px) {
501+
.post-image {
502+
height: 9rem;
503+
width: 9rem;
504+
}
505+
.post-image-short {
506+
margin-top: 0;
507+
}
508+
}
509+
.post-image-small {
510+
width: 100%;
511+
height: 100%;
512+
text-align: center;
513+
display: none;
514+
}
515+
.post-image-small img {
516+
width: 6.25rem;
517+
height: 6.25rem;
518+
}
519+
@media (max-width: 500px) {
520+
.post-image {
521+
display: none;
522+
}
523+
.post-image-small {
524+
display: block;
525+
}
526+
}
527+
501528
.post-preview .post-read-more {
502529
font-weight: 800;
503530
}
@@ -540,28 +567,6 @@ footer .footer-custom-content {
540567
}
541568
}
542569

543-
@media (max-width: 767px) {
544-
.post-image, .post-image img {
545-
margin-top: 0;
546-
height: 9rem;
547-
width: 9rem;
548-
}
549-
}
550-
551-
@media (max-width: 500px) {
552-
.post-image, .post-image img {
553-
height: 6.25rem;
554-
width: 6.25rem;
555-
}
556-
557-
.post-image {
558-
width: 100%;
559-
text-align: center;
560-
margin-top: 0;
561-
margin-left: 0;
562-
float: none;
563-
}
564-
}
565570
/* --- Post and page headers --- */
566571

567572
.intro-header {

0 commit comments

Comments
 (0)