Hello, everyone at AnQi CMS, operation experts and webmasters!I'm glad to discuss with everyone a common but perplexing problem that may be encountered while using AnQiCMS: Why does the front-end page not update as soon as I modify the navigation settings in the background?As an experienced website operations expert, I know how frustrating this 'what you see is not what you get' experience can be.Don't worry, this is not a Bug of AnQiCMS, but some mechanisms behind the operation of the content management system, which pursue high performance and flexibility.Today, let's delve into this issue and provide a set of effective solutions.
Core confusion: The navigation has been updated, why does the front-end remain 'unmoved'?
After carefully adjusting the navigation in the AnQiCMS backend, whether it is adding menu items, modifying links, or adjusting the order, we look forward to the front-end page displaying these changes immediately.However, sometimes things do not go as planned, the front-end navigation remains unchanged, as if the back-end operations have never happened.Behind this, there are usually several main reasons at play.
Firstly, the most common and easiest to overlook isThe cache mechanism of the website. To enhance the website access speed, AnQiCMS, as a high-performance Go language CMS, will naturally widely use caching technology.Cache is like a 'memory copy' of website data, storing frequently used data so that it can be returned faster next time, avoiding the need to query the database or regenerate the page each time.When you modify the navigation settings and the front-end page still displays old content, it is likely that it is reading outdated data from some cache.This cache may exist at multiple levels:
- Browser Caching:Your browser may store the content of the pages you have visited (including navigation) locally to speed up loading.
- AnQiCMS system cache:AnQiCMS itself has a layer of memory or file cache, used to store configuration information, template rendering results, etc., to reduce the overhead of database queries and template parsing.Our document 'AnQiCMS Project Advantages' clearly mentions 'Static Caching and SEO Optimization', which is to improve loading speed and user experience.
- Server-side reverse proxy caching:If your website is deployed after Nginx or Apache web servers and configured with reverse proxy (as shown in documents such as 'Using 1Panel to Install AnQi CMS with Docker Tutorial' or 'Using Baota to Install AnQi CMS with Docker Tutorial'), these proxy servers may also be configured with caching, intercepting the old content returned by AnQiCMS.
- CDN cache:If your website uses a content delivery network (CDN), then CDN nodes will cache your website content globally.This means that even if your source site has been updated, users may still retrieve old cached data from the nearest CDN node when they access it.
Second, the problem may be inThe navigation category does not match the template call. The AnQiCMS 'Website Navigation Settings Help' document details the 'Navigation Category Management' feature.This means you can create multiple independent navigation categories in the background, such as 'Default Navigation', 'Footer Navigation', 'Sidebar Navigation', and add navigation links to them separately.If your front-end template (for exampletag-/anqiapi-other/165.htmlDescribed innavListThe tag) calls istypeId=1The "default navigation", but you changed it in the backgroundtypeId=2The "footer navigation" means that the front-end page will not change naturally. This is a common configuration mistake operators make when using the multi-navigation feature.
Finally, sometimes it isThe issue with the template file itself. Although AnQiCMS encourages the use of dynamic tagsnavListTo call navigation data, but in some custom templates or early versions, developers may choose to hard-code navigation links (write them directly in HTML), or tonavListThe way the label is used is misunderstood, leading to its inability to correctly read or render the updated data on the back end.For example, the 'Template Tag Usage' emphasizes that tags are case-sensitive, and incorrect formatting can lead to incorrect data retrieval.
Solution: Steps to synchronize the front-end update
Understood the cause, and we have a direction for solving the problem. Here is a step-by-step approach, from the smallest priority and impact range to the largest, for troubleshooting and resolving the issue of the front-end not synchronizing after the AnQiCMS backend navigation update.
Step 1: Start from the nearest source - force refresh the browser
This is the simplest and fastest attempt. Your browser may be 'too forgetful' and is still displaying the old cached page.
- Operation method:Attempt to press on the front-end page
Ctrl + F5(Windows/Linux) orCmd + Shift + R(macOS) Perform a forced refresh. This will bypass the browser's local cache and directly request the latest content from the server.
If the problem still exists after the browser is refreshed forcibly, it means that the cache problem is not on your local device, and we need to explore deeper.
Step two: Clean the AnQiCMS system cache
The system cache built into AnQiCMS is one of the key factors affecting the update of front-end content.The system will try to clear related caches every time it updates the data in the background, but to ensure that it is foolproof, manual cleaning is an extremely effective operation.
- Operation method:Log in to the AnQiCMS backend, find the bottom left menu item of “Update CacheFunction. Click it, the system will clear all stored cache data and force a reload of the latest configuration and content from the database.As mentioned in the "Back-end Function Introduction","clearing the system cache data in time ensures that the data is up to date."}
The third step: check if the navigation category matches the template call
This is a troubleshooting point unique to the navigation feature. Make sure you are modifying the navigation category actually referenced by the front-end template.
- Operation method:
- Enter the AnQiCMS backend’sBackend settings" -> "Navigation settings.
- Here, you will see a 'Navigation Category Management' area, which lists all the navigation categories created.Please carefully check which category your modified navigation item belongs to (for example, "default navigation").
- Then, recall or view your frontend template (usually
templateUnder the directoryheader.htmlorbase.htmland other public templates), it may have usednavListLabel to render navigation. For example, the label code might look like this:
Please pay attention.{% navList navs with typeId=1 %} <ul> {%- for item in navs %} <li class="{% if item.IsCurrent %}active{% endif %}"> <a href="{{ item.Link }}">{{item.Title}}</a> {%- if item.NavList %} <dl> {%- for inner in item.NavList %} <dd class="{% if inner.IsCurrent %}active{% endif %}"> <a href="{{ inner.Link }}">{{inner.Title}}</a> </dd> {% endfor %} </dl> {% endif %} </li> {% endfor %} </ul> {% endnavList %}typeIdThe parameter determines which navigation category the template retrieves data from. Ensure that the navigation category ID you modify in the background matches the one in the template.navListlabel'stypeIdThe parameter is consistent. If the template does not havetypeIdIf not specified, it will load the navigation category with ID 1 by default.
Step 4: Clear the server reverse proxy cache or restart the service.
If your website is in front of Nginx, Apache, or other HTTP proxy servers, they may also cache the page content.
- Operation method:
- Nginx:If you are familiar with Nginx configuration, you can find the Nginx cache directory, manually delete the cached files within it, or restart the Nginx service by sending a specific signal (such as
sudo systemctl restart nginx) - Apache:Similarly, check the Apache cache module configuration and clear the cache, or restart the Apache service (for example)
sudo systemctl restart apache2) - Baota Panel/1Panel:If you manage through these panels, there will usually be a "in the website settings.
- Nginx:If you are familiar with Nginx configuration, you can find the Nginx cache directory, manually delete the cached files within it, or restart the Nginx service by sending a specific signal (such as