Advanced development of AnQiCMS templates:archiveListThe elegant secret to removing empty lines between list items in a loop

As an experienced website operations expert, I know that every detail is crucial on the road to pursuing website performance and code tidiness.AnQiCMS with its efficient architecture based on the Go language and flexible Django-style template engine provides strong support for content management and display.archiveListWhen rendering a list with loop tags, extra blank lines will appear in the HTML output.Today, let's delve deeply into this issue and reveal the secret to elegantly removing these blank lines in the AnQiCMS template.

Exploring the root cause: default behavior of template engines

Firstly, let's understand why these blank lines appear quietly. The template engine (Pongo2) of AnQiCMS, when parsing template files, usually keeps the readability of the template code to the greatest extent by labeling (such as{% ... %}And variables like{{ ... }}are output to the final HTML along with newline characters and spaces.

Imagine when we usearchiveListWhen a tag loops to display an article list, a typical template code may look like this:

`twig

    {% archiveList archives with type="list