Easily implement: Add word count and display it on the front end of the article content in Anqi CMS custom content model

Word count is a seemingly simple but very useful feature in content management.In order to help readers quickly assess reading time, optimize content length to comply with SEO strategies, or to control article quality for internal operations, displaying the number of words in the article can provide a direct reference.AnQi CMS with its flexible content model and powerful template tag system, makes this requirement easily accessible.

Next, we will discuss in two main steps how to add word count for specific content fields in Anqi CMS and elegantly present it on the website front-end.

The first step: prepare fields in the content model

Although we will ultimately use template filters to dynamically count words on the front end, it is still recommended to reserve a field for word count in the content model.This allows you to have a clear position to view or manually input word count while editing content in the background, making it convenient for management.

First, please log in to the AnQi CMS backend management interface, click on the left navigation bar's 'Content Management', and then select 'Content Model'.Here, you can choose to edit an existing model, such as 'Article Model' or 'Product Model', or create a custom model according to your business needs.

After entering the detail page of the model you selected or created, scroll the page to find the "Custom fields of the content model" section.Click "Add field", we will create a new custom field for word count functionality.

You can fill in this way in the pop-up field configuration interface:

  • Parameter name:Enter "Word Count" or "Article Word Count". This is a Chinese name for easy identification in the background management.
  • Call field:Suggestedword_count(Or)wordCountPlease maintain consistency). This