Problem iterating over posts

I am attempting to loop over the posts for a site and I am getting a Liquid syntax error in code that used to work. Here is the code in question:

layout: page
title: “Programming Renaissance - Blogs”
author: “Programming Renaissance generated”
date: 2024-03-25

{% comment %}
This page produces a block of HTML for every post recorded in Jekyll, including drafts if enabled. This provides an index to the currently available posts on this site.
{% endcomment %}

Latest Posts

and here is the output from Jekyll:
(PRV) jonathan@jfgdev:/PR/website$ bundle exec jekyll serve --drafts
Configuration file: /mnt/ProgrammingRenaissance/website/_config.yml
Source: /mnt/ProgrammingRenaissance/website
Destination: /mnt/ProgrammingRenaissance/website/_site
Incremental build: disabled. Enable with --incremental
Generating…
Jekyll Feed: Generating feed for posts
Liquid Exception: Liquid syntax error (line 12): Unknown tag ‘post’ in blogs.html
------------------------------------------------
Jekyll 4.3.3 Please append --trace to the serve command
for any additional information or backtrace.
------------------------------------------------
/home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/block.rb:38:in unknown_tag': Liquid syntax error (line 12): Unknown tag 'post' (Liquid::SyntaxError) from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/tags/for.rb:69:in unknown_tag’
from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/block.rb:68:in block in parse_body' from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/block_body.rb:32:in parse’
from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/block.rb:58:in parse_body' from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/tags/for.rb:60:in parse’
from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/tag.rb:10:in parse' from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/block_body.rb:34:in parse’
from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/document.rb:10:in parse' from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/document.rb:5:in parse’
from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/template.rb:130:in parse' from /home/jonathan/gems/gems/liquid-4.0.4/lib/liquid/template.rb:114:in parse’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/liquid_renderer/file.rb:13:in block in parse' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/liquid_renderer/file.rb:70:in measure_time’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/liquid_renderer/file.rb:12:in parse' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:124:in render_liquid’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:80:in render_document' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:63:in run’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:572:in render_regenerated' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:564:in block in render_pages’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in each' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in render_pages’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:211:in render' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:80:in process’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/command.rb:28:in process_site' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65:in build’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36:in process' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in block in process_with_graceful_fail’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in each' from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in process_with_graceful_fail’
from /home/jonathan/gems/gems/jekyll-4.3.3/lib/jekyll/commands/serve.rb:86:in block (2 levels) in init_with_program' from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in block in execute’
from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in each' from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in execute’
from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in go' from /home/jonathan/gems/gems/mercenary-0.4.0/lib/mercenary.rb:21:in program’
from /home/jonathan/gems/gems/jekyll-4.3.3/exe/jekyll:15:in <top (required)>' from /home/jonathan/gems/bin/jekyll:25:in load’
from /home/jonathan/gems/bin/jekyll:25:in <top (required)>' from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in load’
from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in kernel_load' from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:23:in run’
from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/cli.rb:451:in exec' from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/command.rb:28:in run’
from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command' from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor.rb:527:in dispatch’
from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/cli.rb:34:in dispatch' from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/base.rb:584:in start’
from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/cli.rb:28:in start' from /home/jonathan/gems/gems/bundler-2.5.6/exe/bundle:28:in block in <top (required)>’
from /home/jonathan/gems/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:117:in with_friendly_errors' from /home/jonathan/gems/gems/bundler-2.5.6/exe/bundle:20:in <top (required)>’
from /home/jonathan/gems/bin/bundle:25:in load' from /home/jonathan/gems/bin/bundle:25:in

Here is my _config,yml

Welcome to Jekyll!

This config file is meant for settings that affect your whole blog, values

which you are expected to set up once and rarely edit after that. If you find

yourself editing this file very often, consider using Jekyll’s data files

feature for the data you need to update frequently.

For technical reasons, this file is NOT reloaded automatically when you use

‘bundle exec jekyll serve’. If you change this file, please restart the server process.

If you need help with YAML syntax, here are some quick references for you:

Markdown & YAML cheat sheet · Web Dev Topics · Learn the Web

Learn yaml in Y Minutes

Site settings

These are used to personalize your new site. If you look in the HTML files,

you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.

You can create any custom variable you would like, and they will be accessible

in the templates via {{ site.myvariable }}.

title: Programming Renaissance
email: jgossage@gmail.com
description: >- # this means to ignore newlines until “baseurl:”
Working towards the future of software development
baseurl: “” # the subpath of your site, e.g. /blog
url: “” # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: jonathangossage

General site settings

PRS: Programming Renaissance
SAS: System Amanuensis

Build settings

plugins:

  • jekyll-feed

Exclude from processing.

The following items will not be processed, by default.

Any item listed under the exclude: key here will be automatically added to

the internal “default list”.

Excluded items can be processed by explicitly listing the directories or

their entries’ file path in the include: list.

exclude:

- .sass-cache/

- .jekyll-cache/

- gemfiles/

- Gemfile

- Gemfile.lock

- node_modules/

- vendor/bundle/

- vendor/cache/

- vendor/gems/

- vendor/ruby/

I am completely lost and need suggestions on what to do next.

There is a typo in this line:

{{ post.title }} if {% post.author %} - Author: {{ post.author }} {% endif%}

It should instead be:

{{ post.title }} {% if post.author %} - Author: {{ post.author }} {% endif %}

(That is, move the if inside the {% .)

See if that helps!

1 Like

That did it thanks. I looked at this for hours unsucessfully. I figured that the problem had to be somewhere else. I was lucky it was so close.

I’m so glad it worked! Sometimes you just need to step away for a bit :slight_smile: