How does the `config.` file in the AnQiCMS template directory structure affect the selection of navigation templates?

Calendar 👁️ 88

As an experienced website operations expert, I am well aware of the importance of an efficient and flexible content management system (CMS) for website operations.AnQiCMS (AnQiCMS) stands out among many CMSs with its lightweight, efficient, and powerful customizability in the Go language.Today, let's delve into a seemingly insignificant file in the Anqi CMS template directory structure that actually plays a crucial role -config.jsonand how it cleverly influences the selection of website navigation templates.

config.json: The 'ID card' of the template and the core configuration.

In the Anqi CMS template system, each template theme has an independent directory, and the core of this directory contains a file namedconfig.jsonThe configuration file. You can understand this file as the "identity card" or "manual" of this template, which clearly describes the various basic properties and operational status of the template to the AnQiCMS system.

This document contains such items as the name of the template(name), package namepackage), version numberversion), description (description), author information(author/homepage/created)Metadata. This information is important, but it is more used for the display and identification of background management interfaces.The actual operation of the template, especially the two key fields that have a profound impact on the selection of the navigation template we are discussing today:template_typeandstatus.

statusThe field is simple and clear, its value determines whether the current template is in the "use" state. Only when a certain template'sstatusSet to1When in use, AnQiCMS will load and apply the template theme.This is like changing the skin of a website, only the selected skin will take effect.Once a template is activated, itsconfig.jsonother configurations, includingtemplate_typestart to take effect.

template_type: It indirectly affects the navigation layout key

Andtemplate_typeField, it isconfig.jsonIt affects the core of the navigation template selection. It defines the adaption type of the template, currently there are mainly three optional values:

  • 0: Adaptive (Responsive)
  • 1: Code Adaptation
  • 2: Computer + Mobile (Separate PC + Mobile)

These three types directly determine where AnQiCMS will look in the 'drawer' for specific template files when rendering pages, including template fragments that carry navigation structures.

Whentemplate_typeSet to0When adaptive, it usually means that the entire website's interface layout adjusts automatically according to the screen size of the device accessing it.In this mode, the navigation bar is usually designed as a set of schemes, implemented with CSS and JavaScript to achieve responsive layout, such as displaying the full menu on the desktop, and automatically collapsing into a "hamburger" menu on mobile devices.The system will look for such as in the main template directorypartial/header.htmlThis is a public file that contains navigation logic.

However, whentemplate_typeis set to1Or (code adaptation)2When (computer + phone) are independent, the situation changes.Both of these modes mean that AnQiCMS needs to provide a set of independent template files for mobile devices.According to the document agreement, these mobile template files are usually stored in a directory named under the main template directorymobile/in the subdirectory.

Imagine if there is one in your main template directory.default/partial/header.htmlA file that may contain a wide-screen desktop navigation HTML structure. When youconfig.jsontotemplate_typeis set to1or2At this time, AnQiCMS will prioritize going todefault/mobile/partial/header.htmlto find the corresponding mobile navigation structure. Ifmobile/The file exists in the directory, the system will load it, thus presenting a completely different navigation layout for mobile users, such as a full-screen menu or a bottom navigation bar optimized for touch screen.

Therefore,config.jsonoftemplate_typeIt did not directly specify which navigation template file to use, but indirectly told AnQiCMS to find the structure file of the navigation template in which directory according to the device type.This selection mechanism allows developers to design different navigation structures for PC and mobile terminals based on different terminal needs, thereby optimizing the user experience.

Collaboration between navigation data and template rendering

It is worth noting that,config.jsonandtemplate_typewhich affectsHTML structure template file for navigationfor examplepartial/header.htmlormobile/partial/header.html). The actual content displayed in the navigation menu (such as "Home", "Product Center", "About Us" and other links and text) is managed by the "Website Navigation Settings" function of the Anqi CMS backend.

In these structure template files, developers will use the built-in template tags of Anqi CMS, such as{% navList navs %}, to dynamically obtain navigation data from the database. This tag can be used totypeIdParameters (for exampletypeId=1Represents the main navigation,typeId=2Represents the footer navigation) to call the different navigation group data configured on the backend.

Therefore, the navigation effect presented to the user is,config.jsonThe result of the collaborative work of the defined template type, the HTML structure file under the template directory, and the navigation data configured in the background.config.jsonThis is the starting point of this collaboration, it lays the foundation for the presentation of navigation, determining what type of 'container' the navigation layout is.

Summary

In summary, under the Anqi CMS template directory,config.jsonThe file passes through itsstatusThe field activates a specific template theme and throughtemplate_typeThe field indicates the system in the desktop or mobile template directory (such asmobile/) look for the corresponding structure file. This indirect but crucial impact enables website operators and developers to flexibly provide customized navigation experiences for users on different terminals. Understand.config.jsonThe function, is to make full use of Anqi CMS for website content operation and template customization the first step.


Frequently Asked Questions (FAQ)

1.config.jsonoftemplate_typeHow does it specifically affect mobile navigation?

Answer:config.jsonoftemplate_typefield(value1or2Tell AnQiCMS that this template theme supports an independent mobile page structure. When users access it through mobile devices, the system will prioritize the template directory undermobile/Looking for the corresponding template file in the subdirectory, for examplemobile/partial/header.htmlIfmobile/If this file exists in the directory, it will be loaded and use a navigation HTML structure completely different from the desktop version. Iftemplate_typeIs0(Adaptive), it will not go specifically tomobile/The directory search, but the desktop and mobile end share a set of responsive design navigation structure.

2. Can I use multiple sets of navigation layouts in the same template, such as a top navigation and a footer navigation?config.jsonWill this choice affect?

Yes, you can.config.jsonThe main influence is on the overall template type (adaptive, code adaptation, or PC + independent mobile), as well as the system searching for navigation structure files (such aspartial/header.htmlThe position. The actual navigation menu content and grouping are configured in the 'Website Navigation Settings' of the AnQiCMS backend.You can create multiple navigation categories (such as "top navigation", "footer navigation"), and then in your template file, through{% navList navs with typeId=1 %}and{% navList footerNavs with typeId=2 %}tags, according to differenttypeIdThe parameters, each call and render this navigation data.config.jsonIt will not directly affect which one you call.typeIdnavigation data, but it affects where these navigation data are finally rendered in the HTML structure file.

3. If I changeconfig.jsonFile, what do I need to do to make the change take effect?

Answer: When you have modifiedconfig.jsonFile, especially involvingstatusortemplate_typeThis type of core configuration usually requires clearing the AnQiCMS system cache and restarting the application to make the changes take full effect. The system will read when it starts.config.jsonTo determine the current template and its operation mode. You can find options such as 'Update Cache' or similar in the background management interface. In some deployment environments

Related articles

How to accurately highlight the parent menu of the current page in the AnQiCMS navigation menu using the `IsCurrent` property?

## Smart Use of `IsCurrent`: The Art of Smart Highlighting in AnQiCMS Navigation Menu Navigation menus play a crucial role in building any website.It is not only a guide for users to explore the content of the website, but also a direct manifestation of the website structure and user experience.A user-friendly and responsive navigation system that can significantly enhance user satisfaction and effectively guide them to the information they need.AnQiCMS (AnQiCMS) is an efficient and customizable enterprise-level content management system that is well-versed in this field

2025-11-07

How to dynamically generate a multilingual site navigation switcher in AnQiCMS template?

As an experienced website operations expert, I know that building a multilingual website that can reach global users is an important strategy for enterprises to expand their international market and enhance their brand influence.And AnQiCMS, with its efficient, flexible architecture and powerful multi-site, multi-language support capabilities, is undoubtedly the preferred tool to achieve this goal.Today, let's delve into how to dynamically generate a practical and friendly multilingual site navigation switcher in the AnQiCMS template.### Overview of AnQiCMS Multilingual Mechanism In AnQiCMS

2025-11-07

Does AnQiCMS navigation menu's `Title` field support HTML content rendering?

As an experienced website operations expert, I know that every detail in a content management system can affect the security, user experience, and even SEO effect of a website.AnQiCMS (AnQiCMS) is an enterprise-level content management system developed based on the Go language, which has taken into account efficiency, customization, and security from the beginning of its design.Today

2025-11-07

How to add the link attribute `target="_blank"` in AnQiCMS navigation menu?

In today's age of increasingly important digital marketing and user experience, every detail of a website's navigation menu may affect the overall perception and staying time of users on the website.As experienced website operation experts, we know how to enhance the operation efficiency and user experience of a website through clever technological applications.

2025-11-07

If the AnQiCMS website is in "shutdown" status, will the navigation menu still display normally?

As an experienced website operations expert, I know that in the life cycle of a website, there will always be situations where it is necessary to temporarily 'close the site'.Whether it is system upgrade, major content adjustment, or dealing with emergencies, shutting down is an important management function.For those familiar with AnQiCMS (AnQiCMS)Today, let's delve into the performance of AnQiCMS during the shutdown status

2025-11-07

How to create a hidden navigation link in AnQiCMS that does not display in the main navigation but is still used for SEO purposes?

As an experienced website operation expert, I know that skillfully utilizing SEO strategies is crucial in today's competitive online environment.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides us with many tools for implementing advanced SEO operations.One of the very practical tips is to create hidden navigation links that are not displayed in the main navigation but still contribute effectively to SEO value.This strategy is not to deceive search engines, but to optimize user experience at the same time

2025-11-07

Can AnQiCMS navigation tags call other navigation categories in non-navigation templates (such as article detail pages)?

As an expert in website operation for many years, I fully understand that how to flexibly call and display information in a content management system is the key to improving website user experience and operational efficiency.AnQiCMS (AnQiCMS) provides many conveniences in this aspect with its excellent flexibility and powerful functions.TodayThe answer is affirmative, not only can it

2025-11-07

Does AnQiCMS navigation menu support custom icon fonts, such as Font Awesome icons?

In the daily operation of AnQiCMS, the design of the navigation menu and the user experience are often one of the key factors for the success of the website.Many operators hope to be able to add intuitive icons to the navigation menu, such as popular Font Awesome icons, to enhance aesthetics and information transmission efficiency.Then, does AnQiCMS support this custom icon font feature?As an experienced website operations expert, I will give you a detailed explanation.### Deep Analysis of AnQiCMS Navigation Function First, let's examine

2025-11-07