summaryrefslogtreecommitdiff
path: root/www/posts/jigsaw/atom.xml
diff options
context:
space:
mode:
Diffstat (limited to 'www/posts/jigsaw/atom.xml')
-rw-r--r--www/posts/jigsaw/atom.xml20
1 files changed, 10 insertions, 10 deletions
diff --git a/www/posts/jigsaw/atom.xml b/www/posts/jigsaw/atom.xml
index 1929fae..5719a42 100644
--- a/www/posts/jigsaw/atom.xml
+++ b/www/posts/jigsaw/atom.xml
@@ -17,15 +17,15 @@
use Carbon\Carbon;
return [
-'collections' => [
-'posts' => [
-'filter' => function ($item) {
-$date = $item->date ? Carbon::createFromFormat('U', $item->date) : null;
-// Only publish posts that have a date and which is not in the future.
-return $date ? $date <= Carbon::now() : false;
-}
-],
-],
-];</code></pre><p>When deploying the site each post is passed to this filter. The first thing it does is convert the date that has been specified in the post's YAML front matter into a Carbon instance. It then returns true if the date is on or before the current date, I.e. when the site is been deployed.</p><p>With this filter I can specify future dates for several posts and they will only published once that date comes around. Posts are also exluded if a date has not been specified. This allows me to have posts that are a work in progress and shouldn't be published.</p><h3>Links</h3><a href="https://jigsaw.tighten.co/">Jigsaw - Static Site Generator for PHP Developers.</a><a href="https://jigsaw.tighten.co/docs/collections-filtering/">Using Filters in Jigsaw.</a><a href="https://carbon.nesbot.com/">Carbon - PHP API Extension for DateTime.</a><a href="/posts/jigsaw/">Jigsaw - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a>]]</content>
+ 'collections' =&gt; [
+ 'posts' =&gt; [
+ 'filter' =&gt; function ($item) {
+ $date = $item-&gt;date ? Carbon::createFromFormat('U', $item-&gt;date) : null;
+ // Only publish posts that have a date and which is not in the future.
+ return $date ? $date &lt;= Carbon::now() : false;
+ }
+ ],
+ ],
+];</code></pre><p>When deploying the site each post is passed to this filter. The first thing it does is convert the date that has been specified in the post's YAML front matter into a Carbon instance. It then returns true if the date is on or before the current date, I.e. when the site is been deployed. </p><p>With this filter I can specify future dates for several posts and they will only published once that date comes around. Posts are also exluded if a date has not been specified. This allows me to have posts that are a work in progress and shouldn't be published.</p><h3>Links</h3><a href="https://jigsaw.tighten.co/">Jigsaw - Static Site Generator for PHP Developers.</a><a href="https://jigsaw.tighten.co/docs/collections-filtering/">Using Filters in Jigsaw.</a><a href="https://carbon.nesbot.com/">Carbon - PHP API Extension for DateTime.</a><a href="/posts/jigsaw/">Jigsaw - Read More Posts.</a><p>I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.</p><a href="mailto:david@davidtsadler.com">Email david@davidtsadler.com</a><h3>License</h3><a href="https://creativecommons.org/licenses/by-sa/4.0/">The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</a><p>Copyright © 2021 David T. Sadler.</p><a href="/">Return to Homepage.</a>]]</content>
</entry>
</feed> \ No newline at end of file