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:
- 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. - Folder organization mode:Another common way is that the home page content is organized in a folder named
indexwhich 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 editing
index.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.