Which is the default display template file for the home page?

Calendar 👁️ 76

The homepage, as the first impression when users visit your site, is of great importance.It carries multiple functions such as brand image, core information display, and user guidance.For those who are using or planning to use AnQiCMS (AnQiCMS) to build websites, understanding which file is controlling the display of this key page is the first step in personalization and content optimization.

Anqi CMS is committed to providing efficient and customizable content management solutions, naturally also providing you with great freedom to control this core page.Where is the key file that determines the appearance of your website's facade?

The "command center" of the home page:index.htmlorindex/index.html

In the Anqi CMS template system, the default display template file for your website's homepage is usuallyindex.htmlOrindex/index.html. These two files both carry the responsibility of defining the layout and content of the website homepage. Which one to use depends on the file organization mode adopted by the template you choose.

All template files are stored in the installation directory of Anqi CMS./templateIn the folder. Under this root directory, each independent template will have its own dedicated folder.For example, if you are using a template named "default", you will find similar/template/default/Such a directory.

In the exclusive directory of this template, you will find two main forms of homepage file organization:

  1. Flattened file organization mode:In this mode, the homepage file is directly located in the template root directory, that is/template/您的模板目录/index.html. This method is concise and clear, the homepage content is directly defined by this file.
  2. Folder organization mode:Another common way is that the home page content is organized in a folder namedindexwhich is the subfolder named/template/您的模板目录/index/index.htmlThis pattern may appear in large or more complex templates, which helps in better management and division of different page type templates.

Irrespective of the organization method used, these template files are used.htmlAs a file extension. At the same time, the static resources such as images, CSS style sheets, and JavaScript scripts used on the page will be stored in one place./public/static/Under the directory, and reference it in the HTML through template tags.

Why is it so important to understand this file?

Understanding and being able to freely modify this homepage template means that you can:

  • Build a unique brand image:The homepage is the face of the brand, by modifying the template files, you can adjust the layout, color, and font to ensure that the website's visual style is highly consistent with the brand's temperament.
  • Improve user experience and conversion path:Based on user behavior data, you can adjust the presentation order of home page content, highlight core products or services, set clear navigation and action calls (Call-to-Action), and guide users to make purchases, consultations, and other operations.
  • Fine-tuning layout for search engines:AnQi CMS is SEO-friendly, and the homepage is an important basis for search engines to crawl and judge the theme of the website. By directly editingindex.htmlYou can logically arrange keywords, optimize the page structure, and enhance the visibility of the homepage on search engines.
  • Enhance website flexibility:Whether it is to carry out short-term promotional activities or to carry out website redesign, you can directly modify the homepage template, quickly respond to operational needs, and do not need to delve into the backend code.

How to manually modify the homepage template file?

Manually modify the homepage template file, actually it is simpler than you imagine. First, you need to connect to the server through an FTP/SFTP client, find the specific path mentioned above under.index.htmlorindex/index.htmlFile. If your security CMS backend has enabled the template online editing feature, you can directly find and edit it in the "template design" module of the backend, which is more convenient.

The Anqi CMS adopts a syntax similar to the Django template engine, making the writing of template files both intuitive and powerful.This means you can use various built-in template tags to dynamically fill content, not just static HTML. For example:

  • You can use{% system with name="SiteName" %}Tag to retrieve the website name configured in the background global settings.
  • Use{% archiveList archives with type="list" limit="5" %}To display the latest articles or product lists.
  • By{% navList navs %}To dynamically generate the website's navigation menu.

A simple homepage template snippet might look like this:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>{% tdk with name="Title" siteName=true %}</title>
    <meta name="keywords" content="{% tdk with name="Keywords" %}">
    <meta name="description" content="{% tdk with name="Description" %}">
    <link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">
</head>
<body>
    <header>
        <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}">
        <nav>
            <ul>
                {% navList navs %}
                    {% for item in navs %}
                        <li><a href="{{ item.Link }}">{{ item.Title }}</a></li>
                    {% endfor %}
                {% endnavList %}
            </ul>
        </nav>
    </header>

    <main>
        <h1>欢迎来到 {% system with name="SiteName" %}</h1>
        <section>
            <h2>最新动态</h2>
            <ul>
                {% archiveList latestArticles with type="list" moduleId="1" limit="5" %}
                    {% for item in latestArticles %}
                        <li><a href="{{ item.Link }}">{{ item.Title }}</a> - <span>{{ stampToDate(item.CreatedTime, "2006-01-02") }}</span></li>
                    {% endfor %}
                    {% empty %}
                        <li>暂无最新文章。</li>
                {% endarchiveList %}
            </ul>
        </section>
        <!-- 更多内容模块 -->
    </main>

    <footer>
        <p>{% system with name="SiteCopyright" %}</p>
        <p><a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a></p>
    </footer>
</body>
</html>

Masteredindex.htmlorindex/index.htmlThis core file, and you have mastered the 'facade' of the AnQi CMS website, can flexibly adjust and optimize your website homepage according to actual needs, bringing a** visit experience to users.


Frequently Asked Questions (FAQ)

Ask: How can I change the overall template of the website?

Answer: AnQi CMS supports the function of switching between multiple templates. You can find the "Template Design" module or a similar one in the background management interface.Here, the system will list all installed templates, you can select and enable the template you want.Each template directory has oneconfig.jsonthe file, which"status": 1It usually means that the template is in use. Switching through the backend interface is the safest and most recommended way.

Ask: I found that there is both in my template directoryindex.htmland bothindex/index.htmlWhich one will the system use first?

Answer: According to the template design conventions of Anqi CMS, the system will prioritize and use the folder organization mode when loading the homepage.index/index.htmlfile. If the file does not exist, it will then look for and use the template directory underindex.htmlAs the home page template. To avoid confusion and ensure that the template works as expected, it is recommended that you choose when designing or modifying the template.

Related articles

How to embed reusable display components such as sidebars or breadcrumbs in a page?

In website operation, building an efficient and easy-to-maintain website is the key to success.AnQiCMS (AnQiCMS) is well aware of this, providing a flexible template mechanism that allows us to easily embed reusable display components on the page, such as sidebars and breadcrumb navigation.This modular method not only improves development efficiency, but also ensures the consistency of the overall style of the website and future maintainability.This article will delve into how to effectively create and embed these important reusable components using the template system in AnQiCMS.##

2025-11-08

How to reuse header, footer and other common display elements in AnQiCMS templates?

In website operation, efficiency and consistency are the key to success.When you manage a website, you will find that many elements appear repeatedly on different pages, such as headers, footers, navigation bars, sidebars, and so on.If you copy and paste this code manually every time, it is not only inefficient but also prone to errors, not to mention the cumbersome task of adjusting each one individually during subsequent modifications.Fortunately, AnQiCMS's template system is designed to be very flexible, providing powerful mechanisms to help us efficiently reuse these common display elements, ensuring the uniformity of the website style and making maintenance easier.

2025-11-08

How does the `template_type` setting in `config.` affect the overall display mode of the website?

AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides great convenience to our users.During the process of building and operating a website, there is a core configuration file called `config.`, which plays a vital role in each template directory.

2025-11-08

How does AnQiCMS automatically apply the default display template for documents or categories through naming conventions?

In website operation, template management is the key to ensuring the professionalism and consistency of content display.For many operators, manually selecting or specifying a template for each new article or category is undoubtedly a repetitive and time-consuming task.AnQi CMS understands this pain point, therefore it introduces a set of intelligent naming conventions, allowing the system to automatically identify and apply default display templates, thereby greatly simplifying our daily operations.The cleverness of this feature lies in AnQiCMS's ability to intelligently associate content with preset design styles according to the specific naming rules of template files

2025-11-08

Default display template file for article detail page

The Anqi CMS provides a flexible and powerful template mechanism for handling the display of website article detail pages, allowing content operators and developers to finely control the presentation of each article according to actual needs.Understanding the search logic of the default template file is the basis for efficient content management and personalized customization.Firstly, the template files of Anqi CMS are all stored in the `/template` directory and use `.html` as the file extension.

2025-11-08

How to accurately extract the specified position element of a string in Anqi CMS template?

In AnQiCMS template development, we often need to flexibly handle text content, such as extracting the first few words of a long description as a summary, or extracting a specific part of the filename.AnQiCMS's powerful template engine provides a variety of practical filters (filter) to meet these needs, among which the "slice" filter is a powerful tool for precise string truncation.It allows us to easily extract any segment of content we want from a string or array.

2025-11-08

How to extract elements from a specified range in AnQi CMS template?

In the powerful template system of Anqi CMS, we often need to precisely control the display of content.Whether it is an article list, product album, or custom data model, data is often presented in the form of an array.Sometimes, we may only need to display a part of the array, such as only showing the latest three records, or picking out a few images from a picture list.At this point, the `slice` filter provided by AnQi CMS comes in handy, as it helps us elegantly extract elements within a specified range from the array

2025-11-08

How to get only the first N characters of a string using the `slice` filter?

In website content display, we often need to truncate a part of the long text as a preview, abstract, or to ensure the neat layout of the page.For example, it is crucial to control the text length precisely when displaying the article summary on the article list page or setting `meta description` content for search engine optimization (SEO).AnQiCMS (AnQiCMS) powerful template engine provides a variety of flexible filters to help us easily meet these needs.

2025-11-08