forked from shadowfacts/shadowfacts.net
Fix excerpt-less posts
This commit is contained in:
parent
ecad667aed
commit
4202c04598
|
@ -37,8 +37,10 @@ async function generatePostFromFile(postPath: string, additionalMetadata: object
|
||||||
|
|
||||||
if (!(<PostMetadata>page.metadata).excerpt) {
|
if (!(<PostMetadata>page.metadata).excerpt) {
|
||||||
const parts = page.text.split("<!-- excerpt-end -->");
|
const parts = page.text.split("<!-- excerpt-end -->");
|
||||||
|
if (parts.length > 1) {
|
||||||
(<PostMetadata>page.metadata).excerpt = parts[0];
|
(<PostMetadata>page.metadata).excerpt = parts[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
</h2>
|
</h2>
|
||||||
<%- include("article-meta.html.ejs", { metadata: post.metadata }) %>
|
<%- include("article-meta.html.ejs", { metadata: post.metadata }) %>
|
||||||
<div class="article-content" itemprop="description">
|
<div class="article-content" itemprop="description">
|
||||||
<%- post.metadata.excerpt %>
|
<%- post.metadata.excerpt || post.text %>
|
||||||
</div>
|
</div>
|
||||||
|
<% if (post.metadata.excerpt) { %>
|
||||||
<p class="read-more-link">
|
<p class="read-more-link">
|
||||||
<a href="<%= post.metadata.permalink%>">Read more...</a>
|
<a href="<%= post.metadata.permalink%>">Read more...</a>
|
||||||
</p>
|
</p>
|
||||||
|
<% } %>
|
||||||
</article>
|
</article>
|
||||||
|
|
Loading…
Reference in New Issue