Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addDataExtension("yaml", contents => yaml.load(contents)); // Add support for YAML data files
eleventyConfig.setUseGitIgnore(false); // Otherwise docs are ignored
eleventyConfig.setWatchThrottleWaitTime(500); // in milliseconds
eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
excerpt_separator: "<!--more-->",
excerpt_alias: "excerpt"
});

// Set DEV_MODE_POSTS to true if the context is not 'production'
const DEV_MODE_POSTS = process.env.CONTEXT !== "production";
Expand Down Expand Up @@ -495,6 +500,11 @@ module.exports = function(eleventyConfig) {
});

eleventyConfig.addFilter("truncate", function(text, maxWordCount) {
if (text === undefined || text === null || text === "") {
return "";
}

text = String(text);
const split = text.split(" ");
if (split.length <= maxWordCount) {
return text;
Expand All @@ -503,11 +513,6 @@ module.exports = function(eleventyConfig) {
});


eleventyConfig.addFilter("excerpt", function(str) {
const content = new String(str);
return content.split("\n<!--more-->\n")[0]
});

eleventyConfig.addFilter("restoreParagraphs", function(str) {
const content = new String(str);
return "<p>"+content.split(/\.\n/).join(".</p><p>")+"</p>"
Expand Down
4 changes: 2 additions & 2 deletions src/_includes/blog/blog-posts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>
<div class="flex flex-col justify-between md:w-2/3 md:px-2">
<div>
{{ item.templateContent | excerpt | striptags(true)| restoreParagraphs | safe }}
{% include "summary.njk" %}
</div>
<div class="group-hover:underline">read more...</div>
</div>
Expand Down Expand Up @@ -50,7 +50,7 @@
<h3 class="mt-1 mb-0 font-medium group-hover:underline">{{ item.data.title }}</h3>
</div>
<div class="text-sm prose prose-blue md:prose-md py-1">
{{ item.data.description | excerpt | safe }}
{% include "summary.njk" %}
</div>
<div class="italic text-xs mb-3">
<div class="author">
Expand Down
4 changes: 2 additions & 2 deletions src/_includes/blueprints/blueprint-card.njk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>
<h5 class="mt-4 mb-0 group-hover:underline px-4 font-medium text-lg leading-6">{{ item.data.title }}</h5>
<p class="text-sm leading-normal font-light pt-1 mb-4 mt-3 px-4 text-gray-500">
{{ item.data.description | excerpt | safe }}
{{ item.data.description | safe }}
</p>
</a>
<div class="justify-self-end flex flex-row justify-between items-center w-full px-4 py-2 bg-indigo-50/50 mt-auto border-t">
Expand All @@ -35,4 +35,4 @@
class="ff-btn ff-btn--primary-outlined flex gap-2" target="_blank">DEPLOY {% include "components/icons/rocket-launch.svg" %}</a>
</div>
</div>
</li>
</li>
4 changes: 2 additions & 2 deletions src/_includes/certified/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
</div>
</div>
<div class="text-sm prose prose-blue md:prose-md py-1">
{{ node.description | excerpt | safe }}
{{ node.description | safe }}
</div>
</a>
</li>
{%- endeach -%}
</ul>
</div>
{% include "blog/pagination.njk" %}
</div>
</div>
4 changes: 2 additions & 2 deletions src/_includes/changelog/changelog-posts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div class="flex-grow pt-4">
{% if item.data.tags.includes("posts") %}
<div class="prose">
{{ item.templateContent | excerpt | striptags(true)| restoreParagraphs | safe }}
{% include "summary.njk" %}
</div>
<a href="{{ item.url }}" class="group-hover:underline">read more...</a>
{% else %}
Expand All @@ -31,4 +31,4 @@
</div>
{% endif %}
</div>
</li>
</li>
4 changes: 4 additions & 0 deletions src/_includes/summary.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% set summary = item.data.excerpt or item.data.description or item.data.meta.description %}
{% if summary %}
{{ summary | md | safe }}
{% endif %}
2 changes: 1 addition & 1 deletion src/blog/2023/07/dashboard-0-1-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tags:
- dashboard
---

Just weeks ago, we at FlowFuse [announced our plan](../../06/dashboard-announcement) to develop a successor to the Node-RED Dashboard. Today, we're excited to reveal the pre-alpha release of this highly anticipated project, bringing us one step closer to a new era of data visualization in Node-RED.
Just weeks ago, we at FlowFuse [announced our plan](/blog/2023/06/dashboard-announcement/) to develop a successor to the Node-RED Dashboard. Today, we're excited to reveal the pre-alpha release of this highly anticipated project, bringing us one step closer to a new era of data visualization in Node-RED.

<!--more-->

Expand Down
4 changes: 2 additions & 2 deletions src/community/newsletter.njk
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ hubspot:
</div>
<div class="flex flex-col justify-between md:w-2/3 md:px-2">
<div>
{{ item.templateContent | excerpt | striptags(true)| restoreParagraphs | safe }}
{% include "summary.njk" %}
</div>
<div class="group-hover:underline">read more...</div>
</div>
Expand All @@ -63,7 +63,7 @@ hubspot:
<h3 class="mt-1 mb-0 font-medium group-hover:underline">{{ item.data.title }}</h3>
</div>
<div class="text-sm prose prose-blue md:prose-md py-1">
{{ item.data.description | excerpt | safe }}
{% include "summary.njk" %}
</div>
<div class="italic text-xs mb-3">
<div class="author">
Expand Down
6 changes: 3 additions & 3 deletions src/llms.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ eleventyExcludeFromCollections: true

## Documentation
{%- for doc in collections.docs | reverse %}
- [{{ doc.data.navTitle }}]({{ site.baseURL }}{{ doc.url | replace(r/.$/, ".md") }}): {{ doc.data.meta.description or doc.templateContent | excerpt | truncate(100) | striptags }}
- [{{ doc.data.navTitle }}]({{ site.baseURL }}{{ doc.url | replace(r/.$/, ".md") }}): {{ doc.data.meta.description or doc.data.description or doc.data.excerpt | truncate(100) | striptags }}
{%- endfor %}

## Customer Stories
{%- for story in collections.stories | reverse %}
- [{{ story.data.title }}]({{ site.baseURL }}{{ story.url | replace(r/.$/, ".md") }}): {{ story.data.subtitle or story.data.description or story.templateContent | excerpt | truncate(100) | striptags }}
- [{{ story.data.title }}]({{ site.baseURL }}{{ story.url | replace(r/.$/, ".md") }}): {{ story.data.subtitle or story.data.description or story.data.meta.description or story.data.excerpt | truncate(100) | striptags }}
{%- endfor %}

## Webinars
{%- for webinar in collections.webinar | reverse %}
- [{{ webinar.data.title }}]({{ site.baseURL }}{{ webinar.url | replace(r/.$/, ".md") }}): {{ webinar.data.description or webinar.templateContent | excerpt | truncate(100) | striptags }}
- [{{ webinar.data.title }}]({{ site.baseURL }}{{ webinar.url | replace(r/.$/, ".md") }}): {{ webinar.data.description or webinar.data.meta.description or webinar.data.excerpt | truncate(100) | striptags }}
{%- endfor %}
8 changes: 3 additions & 5 deletions src/webinars.njk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ meta:
</a>
<div class="flex flex-col justify-between md:w-1/2 md:px-2">
<div class="grow">
{{ item.templateContent | excerpt | striptags(true)| restoreParagraphs | safe }}
{% include "summary.njk" %}
</div>
<div>
{%- if item.data.tags.includes('ama') -%}
Expand Down Expand Up @@ -86,13 +86,11 @@ meta:
<h3 class="mt-1 mb-0 font-medium group-hover:underline">{{ item.data.title }}</h3>
</div>
<div class="text-sm prose prose-blue md:prose-md py-1">
{% if item.data.description %}
{{ (item.data.description | excerpt | safe) }}
{% endif %}
{% include "summary.njk" %}
</div>
</a>
</li>
{%- endfor -%}
</ul>
{% endif %}
</div>
</div>
Loading