As an experienced website operations expert, I know the importance of an efficient and flexible content management system (CMS) for website operations.AnQiCMS stands out among many CMS solutions with its lightweight, efficient Go language implementation and powerful customizability.config.json[en] As well as how it cleverly influences the selection of website navigation templates.
config.json[en] : The 'ID card' of the template and the core configuration
In the template system of AnQi CMS, each template theme has an independent directory, and the core of this directory contains a document namedconfig.jsonThe configuration file.You can understand this file as the 'ID card' or 'instruction manual' of this template, which clearly describes the basic properties and operational status of the template to the AnQiCMS system.
This document includes such items as the name of the template (name), package name (package), version number (version), description (description), and author information (author/homepage/createdMetadata such as ) and the like.This information is important, but it is more used for displaying and identifying in the background management interface.template_typeandstatus.
statusThe field is simple and clear, its value determines whether the current template is in the "In Use" state. Only when a template is in usestatusis set to1When [en]is used, AnQiCMS will load and apply the template theme.This is like changing the skin of a website, only the selected skin will take effect.config.jsoninclude other configurations,template_typeit starts to take effect.
template_type:Key that indirectly affects the navigation layout.
whiletemplate_typeIs a field, then.config.jsonIs the core of affecting the selection of navigation templates. It defines the type of adaptation of the template, and currently there are mainly three optional values:
0【en】Responsive1【en】Code Adaptation2【en】Computer + Mobile Separate
These three types directly determine which 'drawer' AnQiCMS will go to search for specific template files when rendering pages, including template fragments that carry the navigation structure.
Whentemplate_typeis set to0When it says (Adaptive), it usually means that the entire website's interface layout will automatically adjust according to the screen size of the device being accessed.In this mode, the navigation bar is usually designed as a set of solutions, 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.partial/header.htmlThis is a common file that includes navigation logic.
However,template_typeset1(Code adaptation) or2When [computer + phone independent] is the case, things become different.Both of these modes mean that AnQiCMS needs to provide a set of independent template files for mobile devices.mobile/in the subdirectory.
Imagine if there is a main template directory under your main directory.default/partial/header.htmlA file, it may contain an HTML structure for a wide-screen desktop navigation. But when youconfig.jsontotemplate_typeset1or2, AnQiCMS will prioritize going todefault/mobile/partial/header.htmlto find the corresponding mobile navigation structure. Ifmobile/The system will load this file if it exists in the directory, thus presenting a completely different navigation layout to mobile users, such as a full-screen menu optimized for touch or a bottom navigation bar.
Therefore,config.jsonoftemplate_typeIt does not directly specify which navigation template file to use, but indirectly tells AnQiCMS to 'go to which directory to find the structure file of the navigation template according to the device type'.This selection mechanism allows developers to design different navigation structures with unique features and experiences for PC and mobile terminals based on various terminal requirements, thereby optimizing the user experience.
Navigation data collaboration with template rendering
It is worth noting that,config.jsonandtemplate_typeWhat is affected byNavigation HTML structure template file[for example]partial/header.htmlormobile/partial/header.html)。The actual content displayed in the navigation menu (such as 'Home', 'Product Center', 'About Us', and these links and text) is managed by the 'Website Navigation Settings' feature of the Anqi CMS backend.
In these structure template files, developers will use the template tags built into the Anqi CMS, such as{% navList navs %}, to dynamically retrieve navigation data from the database. This tag can be based ontypeIdParameters (e.g.,)typeId=1represent the main navigation,typeId=2represent the footer navigation) to call the data of different navigation groups set up by the background.
Therefore, the navigation effect presented to the user is,config.jsonThe result of the collaborative work among the defined template type, the HTML structure files under the template directory, and the navigation data configured in the background.config.jsonThis is the starting point of this collaboration, laying the foundation for the presentation of navigation and determining the type of 'container' the navigation layout is.
Summary
In summary, the template directory under the Anqi CMS template.config.jsonFile passes through itsstatusField activates a specific template theme, and throughtemplate_typeField indicates the system in the desktop or mobile template directory (such asmobile/Find the corresponding structure file in the bracket.This indirect but crucial impact allows website operators and developers to flexibly provide tailored navigation experiences for users on different terminals.config.jsonThe function, is the first step to efficiently use the security CMS for website content operation and template customization.
Common Questions (FAQ)
1.config.jsonoftemplate_typeHow does it specifically affect the mobile navigation?
Answer:config.jsonoftemplate_typefield (value)1or2Tell AnQiCMS that this template theme supports an independent mobile page structure. When users access through mobile devices, the system will prioritize the pages under the template directory.mobile/Search for the corresponding template file in the subdirectory, for example,mobile/partial/header.html.mobile/If this file exists in the directory, it will be loaded and use a completely different navigation HTML structure than the desktop version. Iftemplate_typeYes0(Adaptive), it will not have a special one.mobile/The directory search is not used, instead, both the desktop and mobile ends share a set of responsive design navigation structures.
Can I use multiple navigation layouts in the same template, such as a top navigation and a footer navigation?config.jsonWill this choice affect it?
Answer: Yes.config.jsonThe main influence is on the overall template type (adaptive, code adaptation, or PC + mobile independent), as well as the system searching for navigation structure files (such aspartial/header.htmlThe position of ).The actual navigation menu content and grouping are configured in the "Website Navigation Settings" of AnQiCMS.{% navList navs with typeId=1 %}and{% navList footerNavs with typeId=2 %}tags, based on differenttypeIdParameters, which call and render these navigation data respectively.config.jsonIt will not directly affect which one you call.typeIdThe navigation data, but it will affect which HTML structure file the navigation data is finally rendered in.
3. If I changeconfig.jsonFile, what do I need to do to make the changes take effect?
Answer: When you have modifiedconfig.jsonthe file, especially when it involvesstatusortemplate_typeThis core configuration usually requires clearing the AnQiCMS system cache and restarting the application to make the changes take full effect. The system reads when it starts.config.jsonTo determine the currently used template and its runtime mode. You can find the option 'Update Cache' or similar in the background management interface to perform this action. In some deployment environments