In website operation, friend links are an important way to enhance website authority, increase external traffic, and strengthen user trust.The auto feature of AnQiCMS (AnQiCMS) provides convenient functions, allowing you to easily display these valuable external links at the bottom of your website.
Step 1: Add and configure the friend links in the background management
Firstly, we need to add and manage the friend links in the Anqi CMS backend management system. This is like preparing the content list that you want to display on the website.
- Log in to the backend:Use your administrator account to log in to the AnQi CMS backend.
- Enter Function Management:In the left navigation bar, find and click the "Function Management" menu item.
- Select Friend Links:In the "Feature Management
- Add or edit links:
- Click the "Add Friend Link" button to start creating a new link.
- You need to fill in the following information:
- Link Name (Title):This is the display name of the friendship link on the website, it should be concise and clear, usually the name of the other website.
- Link Address (Link):Enter the full URL address of the other website, for example
https://www.example.com. - Link Remark (Remark):This can be a brief description about this link, convenient for your own management, usually not displayed on the front end.
- Is Nofollow (Nofollow):This is an important SEO option. If this option is checked, the link will be accompanied by
rel="nofollow"Property, tells the search engine not to pass link weight. For external友情链接 links, it is usually recommended to check this option to avoid excessive weight transfer and control SEO risks.
Complete the information entry, click save, and your friendship link will be successfully added to the backend database.You can repeat this step to add more links, and you can come back to edit or delete existing links at any time.
第二步:In the website template, call and display the friend link list
Next, we need to display the friend links added in the background on the website's front page. This usually involves modifying the website's template files.
Confirm the display position:Friendship links list is usually placed in the footer area of the website. In Anqi CMS, the footer content is often in a separate template fragment file, for example
partial/footer.htmlOr, inbash.htmlIf your template uses this common code structure.Use
linkListTags:AnQi CMS provides a special template tag for calling friend linkslinkListThis label is very intuitive, allowing you to retrieve all the friendship link data you have configured in the background.You can use the following code to add the friendship link list to your template file:
{% linkList friendLinks %} {% if friendLinks %} <div class="footer-links"> {# 可以为友情链接列表添加一个容器以便样式控制 #} <h3>友情链接</h3> <ul> {% for item in friendLinks %} <li> <a href="{{item.Link}}" {% if item.Nofollow == 1 %} rel="nofollow"{% endif %} target="_blank">{{item.Title}}</a> </li> {% endfor %} </ul> </div> {% endif %} {% endlinkList %}Let's decode this piece of code:
{% linkList friendLinks %}This is the label called for the friend link list.friendLinksThis is the variable name you define for this list. You will access the link data through this variable later.{% if friendLinks %}: This is a conditional judgment. It checksfriendLinksDoes the variable have data (i.e., has the back-end added a friend link)?This can prevent the display of an empty 'Friend Links' title or a blank area when there are no friendship links, enhancing the page's neatness.<div class="footer-links">...</div>This is an HTML structure used to wrap the list of friendship links. You can customize the CSS class for your website design to control its style and layout.divAdd a custom CSS class to control the style and layout.<h3>友情链接</h3>:an English translation of a simple title, explicitly indicating that this part of the content is a friend link.<ul>...</ul>and<li>...</li>:an English translation of standard HTML unordered list structure, each<li>contains a friend link.{% for item in friendLinks %}English: This is a loop tag, it will iterate overfriendLinksEach friendship link data in the variable, and name ititem.<a href="{{item.Link}}" ... >{{item.Title}}</a>: This is the actual HTML code displayed for the friendship link.{{item.Link}}: Dynamically outputs the link address set in the background.{{item.Title}}:Dynamic output the link name set in the background.{% if item.Nofollow == 1 %} rel="nofollow"{% endif %}:This is a conditional judgment, if the link is set asnofollowin the background.<a>tags will be automatically added.rel="nofollow"properties.target="_blank":This property will open the link in a new window or a new tab, which helps users stay on your website.
{% endfor %}:End of loop tag.{% endif %}:End of conditional judgment tag.{% endlinkList %}:linkListThe end tag of the label.
Save and update the cache:After modifying the template file, be sure to save the changes.To ensure that the front-end page reflects your changes immediately, it is recommended that you log in to the Anqi CMS backend, click "Update Cache" to clear the system cache.
Through these steps, you can elegantly display your friends link list at the bottom of the website built with Anqi CMS.This can not only effectively manage external links, but also help improve the website's SEO performance and user experience.
Common Questions (FAQ)
- I added a friend link in the background, but the front page did not display. What could be the reason?There are usually several possible reasons: First, please confirm whether you are in the correct template file (such as
footer.htmlorbash.html) and addedlinkListLabel code.Next, check if there are any syntax errors, such as spelling mistakes or unclosed tags.Finally, after modifying the template file, please make sure to go to the "Update Cache" feature in the background management interface, clear the website cache, so that the front-end can load the latest template content. - Can the display order of the友情链接 links be adjusted?In the current friend link management interface of AnQi CMS, links are usually displayed in the order of addition or default ID order.If you need to customize the sorting, you may need to adjust it individually through the backend editing feature, or use the sorting feature of the template after obtaining the data (if your template engine version supports it).
linkListThe tag itself does not provide directorderparameters to control sorting. - Is it possible to group the友情链接(friendship links) to be displayed, such as the two groups "Partners" and "Technical Support"?
linkListThe label's current design is to retrieve the unified list of all friendship links from the backend, without built-in direct grouping parameters to distinguish the display. If you have a need for grouped display, you can consider two methods:- Method one (recommended):Add friendship links in the background and use the "Link Note" field for marking, such as noting as "Partner" or "Technical Support". Then, after obtaining all links in the template,
ifConditional judgmentitem.RemarkThe content to manually group and display. - Method two (advanced):If your business logic is very complex and requires more flexible group management, consider using the custom content model or custom field feature of AnQi CMS to create a special module for 'external cooperation' or 'partners', and manage and call links with group attributes through this module.
- Method one (recommended):Add friendship links in the background and use the "Link Note" field for marking, such as noting as "Partner" or "Technical Support". Then, after obtaining all links in the template,