As an experienced website operations expert, and deeply familiar with AnQi CMS, I often encounter users who are confused about the working principles of some auxiliary functions during template development. Today, let's delve into a seemingly simple yet easily misunderstood topic -loremHow is the content generated by the tag stored in the database of Anqi CMS?

loremTag: The 'extra actor' in the template world

First, let's be clearloremThe location of the label in the Anqi CMS template. In the Anqi CMS template system,loremclassified as 'Other auxiliary tags', as mentioned in the documentdesign-tag.mdandtag-tags.mdas stated.Its main responsibility is to generate random, meaningless placeholder text content.loremLabels are powerful assistants used by template designers and developers in the early stages of website construction, when content is not yet ready, to quickly fill in page layouts, test styles, and the effects of typography.

For example, when you design a template for an article detail page, you might want to see the actual display effect of a long article on the page, but at this time, you do not have enough long article content. At this time, you can simply use{% lorem 3 p %}Generate three placeholder paragraphs quickly to simulate the length and paragraph structure of real content, thereby adjusting CSS styles or JavaScript behaviors to ensure that the page remains beautiful and functional when real content is present.

The template rendering mechanism of AnQi CMS andloremin essence

To understandloremWhether the content generated by the tag is stored in the database, we must first understand the template rendering mechanism of the Anqi CMS.Anqi CMS adopts a syntax style similar to Django template engine and realizes fast template rendering through the high-performance characteristics of Go language.

  1. Receiving requests:The server receives a user's access request to a certain page.
  2. Data preparation:The Anqi CMS queries and prepares all the necessary real data from the database according to the type of requested page (such as article details, category list, single page, etc.).
  3. Template parsing and rendering:Load the corresponding.htmltemplate file. At this stage, the template engine will parse the template code line by line. When encounteringarchiveList/categoryDetailWhen calling the tag, it will fill it with the real data prepared in the second step; while encounteringloremat this time, the template engine willgenerate dynamicallySpecify the length and format of random text.
  4. Content output:After all data is filled and dynamic content generation is complete, the template engine will send the final HTML content to the user's browser.

We can clearly see from this process,loremthe content generated by the tags isreal-time generation and consumptionof the process.This random text is generated and rendered when the page is requested, and its lifecycle is limited to this page request and response.The temporary text will be discarded after the server sends the generated HTML to the browser, and it will not be retained, nor written to the underlying database of the security CMS.It's like a temporary canvas that appears only when the designer needs it, and is erased once the design is completed, not becoming a part of the final work.

How is the real content stored? Compared withloremthe fundamental difference

SinceloremThe content generated is not stored in the database, so how is the actual content of the website stored? This is where the core function of the Anqi CMS as a content management system lies.

The AnQi CMS provides the 'Flexible Content Model' feature, allowing users to customize various content structures such as articles, products, etc. (see)AnQiCMS 项目优势.mdandhelp-content-module.md)。When you go through the background functions such as 'Add Document', 'Page Management', and so onhelp-content-archive.md/help-source-page.mdWhen you publish content, all the text, images, video links, and information such as titles, keywords, summaries, custom fields, and other information you enter in the rich text editor will be received and processed by the backend program of the Anqi CMS.Persistent storageto its configured MySQL database.

These data stored in the database have independent IDs, associated category information, publication time, and metadata, and can be edited, modified, and deleted through the back-end management interface, as well as beingarchiveDetail/pageDetailTags are accurately read from the database and displayed on the front-end page. This contrasts withloremthe temporary and meaningless characteristics of tags.

In summary,loremTags in AnQi CMS are just a helper tool at the template rendering stage, and their content will not be stored in the database.The database is responsible for storing all the authentic and valuable website content that you carefully edit and publish through the backend.


Common Questions and Answers (FAQ)

  1. Q: How can I store some default text content in the database instead of generating random text each time?A: If you need to store fixed default text, such as product description templates, company profile templates, etc., you should create a new document, a single page, or add a custom field in the content model on the Anqi CMS backend, and set a default value for the field. Then, use the corresponding tags (such asarchiveDetailorpageDetailCall these preset text contents using the field name 【en】

  2. Q: Use 【en】loremDoes the content generated by tags affect the website's SEO? 【en】A:loremThe content generated by the tag itself has no SEO value and is just a placeholder. Of course, it is fine to use it during website development and testing phases.Absolutely do not use tags containingloremThe content page is launched into the production environment.Search engine crawlers will recognize these meaningless texts, which may result in the page being deemed as low-quality content, thereby severely damaging the SEO ranking of the website.loremGenerated placeholder text.

  3. Q: Can Iloremapply other AnQiCMS template filters to the content generated by the tags?A: Of course, you can.loremThe output of the label in the template rendering process is essentially a piece of plain text. Therefore, you can apply various template filters provided by the Anqi CMS to any other string variable, such astruncatechars(Truncated Character) ,wordwrap(Word wrap) orupper(Convert to uppercase) etc., to further test the display effect of the page under different text processing conditions. For example:{% lorem 100 w | truncatechars:50 %}It will generate a text of 100 words, then truncate to the first 50 characters and add an ellipsis.