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

Calendar 👁️ 83

In the daily operation of AnQiCMS (AnQiCMS), the design of the navigation menu and user experience are often one of the key factors for the success of the website.Many operators want to add intuitive icons to the navigation menu, such as popular Font Awesome icons, to enhance aesthetics and information transmission efficiency.So does AnQiCMS support this custom icon font feature?As an experienced website operations expert, I will give you a detailed interpretation.

AnQiCMS navigation function in-depth analysis

First, let's examine the navigation management function of the AnQiCMS backend.The document describes that AnQiCMS provides the "website navigation settings" feature, allowing users to flexibly configure the navigation links in the background.You can set the 'Display Name', 'Subtitle Name', 'Navigation Description', and select the 'Link Type' (Built-in Link, Category Page Link, External Link) and 'Display Order'.In addition, AnQiCMS supports navigation links up to two levels, namely the first-level navigation and the second-level dropdown navigation under it.

However, we did not find any fields specifically used to set 'icons' or 'CSS classes' among these core configuration items.This means that, from the very beginning of the design of AnQiCMS, its background navigation management module did not have a direct input box or dropdown option for users to select or enter the icon font class name.navListAvailable fields of template tags (such asTitle,SubTitle,Description,Linketc.) also indeed do not have a field namedIconorClassfield exposed directly for front-end template calls.

This does not mean that AnQiCMS cannot implement the customization of navigation icons!On the contrary, thanks to the open and flexible template system of AnQiCMS, we can achieve this requirement through the customization of the front-end template, and the method is very flexible.

Customize navigation icons through template mechanism

One of AnQiCMS's core strengths is its highly customizable and modular design.It uses a syntax similar to the Django template engine, allowing operators and developers to fully control the HTML, CSS, and JavaScript of the website's frontend.This means that even if there is no direct icon field in the background, we can integrate icon fonts into the navigation menu by writing a small amount of code in the template.

To implement custom icon fonts, such as Font Awesome, usually requires the following two key steps:

Step 1: Introduce the Font Awesome icon font library

This is the premise of all using Font Awesome.You need to include the Font Awesome CSS file in your website template.The most common way is to use CDN services or download the file to the local server.

For example, when introducing via CDN, you can in your template<head>area (usuallytemplate/您的模板目录/bash.htmlortemplate/您的模板目录/index.htmlAdd similar code to the common header files

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg==" crossorigin="anonymous" referrerpolicy="no-referrer" />

Step two: Modify the navigation list template

In AnQiCMS, the navigation list is usually accessed throughnavListThe label is rendered in the template. You need to find the template file responsible for rendering the navigation menu (for example, it may be inpartial/header.htmlorindex/index.htmlwhich contains the navigation loop code).

Here are two common implementation approaches:

  • Option one: judge by navigation title or ID conditionsYou cannavListIn the loop, according to the navigation item'sTitle(Display name) orIdPerform a conditional judgment and then insert the corresponding Font Awesome icon.

    For example, your template code might look like this:

    {% navList navs %}
    <ul>
        {%- for item in navs %}
        <li>
            {% if item.Title == "首页" %}
                <i class="fa fa-home"></i> <!-- Font Awesome 图标 -->
            {% elif item.Title == "产品" %}
                <i class="fa fa-box"></i>
            {% elif item.Title == "联系我们" %}
                <i class="fa fa-phone"></i>
            {% endif %}
            <a href="{{ item.Link }}">{{item.Title}}</a>
            {%- if item.NavList %}
            <dl>
                {%- for inner in item.NavList %}
                    <dd><a href="{{ inner.Link }}">{{inner.Title}}</a></dd>
                {% endfor %}
            </dl>
            {% endif %}
        </li>
        {% endfor %}
    </ul>
    {% endnavList %}
    

    The advantages of this method are intuitive and easy to understand, but the disadvantages are that it can be cumbersome to maintain if the navigation title changes or if icons need to be set for a large number of navigation items.

  • Plan two: skillfully utilize the 'navigation description' field (recommended)AnQiCMS navigation settings contain a 'navigation description' field.Although it is intended for textual description, we can cleverly use it to store Font Awesome's class names.

    1. Operate in the background navigation settings:Enter the AnQiCMS admin panel -> admin settings -> navigation settings. Edit your navigation items, enter the Font Awesome class name you want to use in the 'navigation description' field, for examplefa-solid fa-house(Font Awesome 6 syntax).

    2. Call in the template:Modify in your navigation list template,navListLoop through, by{{item.Description}}Get these class names and apply them to a<i>tag:

      {% navList navs %}
      <ul>
          {%- for item in navs %}
          <li>
              {% if item.Description %}
                  <i class="{{item.Description}}"></i> <!-- 动态插入 Font Awesome 图标 -->
              {% endif %}
              <a href="{{ item.Link }}">{{item.Title}}</a>
              {%- if item.NavList %}
              <dl>
                  {%- for inner in item.NavList %}
                      <dd><a href="{{ inner.Link }}">{{inner.Title}}</a></dd>
                  {% endfor %}
              </dl>
              {% endif %}
          </li>
          {% endfor %}
      </ul>
      {% endnavList %}
      

      This solution's advantage lies in the fact that icon class names are stored in the background, making it convenient for operation personnel to directly manage and modify them, without needing to edit template codes each time, greatly improving maintainability and flexibility.

Summary

Although AnQiCMS's backend navigation menu management does not provide a ready-made 'icon' selector or input box, but with its efficient architecture based on the Go language and flexible design based on the Django template engine, you can completely customize the front-end template to integrate Font Awesome or any other icon font library. By introducing the icon library CSS in the public header file, and cleverly utilizing the 'navigation description' field innavListInserting icon class names dynamically in the loop can easily achieve personalized customization of the navigation menu.This method not only effectively solves the icon display problem, but also fully demonstrates the strong flexibility of AnQiCMS in secondary development and content operation.


Frequently Asked Questions (FAQ)

  1. Ask: If I am not familiar with HTML and CSS, does AnQiCMS have a simpler method to add navigation icons?Answer: The default functions provided by AnQiCMS indeed require you to have a certain level of HTML and CSS knowledge to modify the template. If you are not familiar with these technologies, you can consider the following methods: first, try using

Related articles

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

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

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 does the `config.` file in the AnQiCMS template directory structure affect the selection of navigation templates?

As an experienced website operation expert, I deeply understand the importance of an efficient and flexible content management system (CMS) for website operation.AnQiCMS (AnQiCMS) stands out among many CMS systems with its lightweight, efficient Go language and powerful customizability.Today, let's delve into a seemingly insignificant but actually crucial file in the Anqi CMS template directory structure, namely `config.`, and how it subtly influences the selection of the website navigation template.

2025-11-07

How to configure the mouse hover effect or animation of navigation menu items in AnQiCMS backend?

## Mastering AnQiCMS Navigation Menu Hover Effect: The Perfect Combination of Backend Configuration and Frontend Ingenuity In today's web design, the navigation menu is no longer just a tool to guide users through the site; it is also an important window to enhance user experience and showcase brand vitality.A well-designed, smooth interactive navigation menu, especially one with mouse hover effects or animations, can make a website come alive instantly.As an experienced website operations expert, I know that many AnQiCMS users hope to add such interactivity to their website menus.But it should be clear that

2025-11-07

Does AnQiCMS have a built-in caching mechanism when fetching data from the navigation list tags?

Dear operations partners, hello!As an expert with many years of experience in website operations, I am well aware of the importance of website performance for user experience and Search Engine Optimization (SEO).AnQiCMS, with its excellent performance and flexibility, has gained a place in the field of content management.Today, we will delve deeply into a common concern: Does AnQiCMS's navigation list tag have a built-in caching mechanism when fetching data?This is not only about the technical implementation, but also closely related to the efficiency of our daily content operation.

2025-11-07

How to display dynamic data in the AnQiCMS navigation menu, such as the number of unread messages?

As an experienced website operations expert, I fully understand the core status of the navigation menu in user experience and website architecture.It is not only the index of the content, but also the key to users quickly obtaining the information they need and improving conversion efficiency.Today, we will delve into how to cleverly integrate dynamic data into the navigation menu of AnQiCMS (AnQi CMS), such as the number of unread messages that everyone cares about, which will undoubtedly greatly enhance user interaction and the vitality of the site.### Insight requirements: The challenge of integrating static navigation with dynamic data Traditional website navigation menus are often static.

2025-11-07

Does the AnQiCMS navigation menu display different navigation structures according to device type (PC/Mobile)?

Good, as an experienced website operation expert, I am very willing to deeply analyze the ability of AnQiCMS in the differentiation display of navigation menus and transform it into an article that is easy to understand and practical. --- ## Safe CMS Navigation Menu: The Secret of PC/Mobile End Differentiation Display In today's multi-screen interconnection era, users visit websites with various types of devices.Whether it is the wide screen on the PC end or the compact interface on the mobile end, users expect to get a smooth and intuitive browsing experience.

2025-11-07