We use cookies to make your viewing experience better. By accepting you consent, you agree to our Cookie policy

Improve your Craft CMS skills

How To Add Links In The Footer Section On Craft CMS

10 min read
Shape April 2022 HR 189

Struggling to build an intuitive footer with essential site-wide links on Craft CMS? Footer navigation is crucial for usability and SEO, yet implementing optimized footer links can be tricky. This guide provides actionable tips to effortlessly add engaging footer links in Craft CMS. Learn how to seamlessly link site-wide pages, troubleshoot issues, and structure footer navigation for the best user experience.

To add footer links in Craft CMS, navigate to the footer.twig template, then insert properly formatted anchor tags <a> with descriptive text and relative URL links. Organize multiple footer links in logical sections, test thoroughly, and optimize anchor text for SEO. Valid markup and semantic structure creates an intuitive footer navigation experience.

Adding Footer Links in Craft CMS

Overview of Footer Links in Websites

Footer links are navigational links that are commonly found at the bottom of web pages across an entire website. They provide quick access to important site-wide pages such as Contact, About Us, Privacy Policy, Terms of Conditions, and more. Having a consistent set of footer links on every page aids user navigation and the overall user experience.

Website visitors expect and rely on footer links for quick access to key information without having to use internal site search or navigate back to the home page. Well-organized footer links that remain consistent across all pages also demonstrate professionalism and enhance usability.

Benefits of Using Footer Links

Implementing intuitive and consistent footer links offers numerous benefits:

Easy Site Navigation

Having thoughtfully organized footer links eliminates the need for users to repeatedly return back to the home or internal search pages to find what they need. Site visitors can simply scroll down to the bottom of any page and quickly jump to the desired section. This facilitates easy site navigation and information discovery.

Quick Access to Important Pages

Pages like Contact, About Us, Terms & Conditions, Privacy Policy, Blog, Help/FAQs are vital for websites. Footer links enable instant access to these critical pages from anywhere on the site. Users don't have to waste time hunting for these pages.

Enhanced User Experience

Well-structured footer links demonstrate attention to detail and enhance the overall user experience. Visitors feel taken care of when they can easily find what they need through footer links on each page. Removing navigation friction keeps users happy and engaged.

Demonstrates Professionalism

A thoughtfully organized footer conveys credibility and professionalism. Users equate easy site navigation with how professionally a website and brand are managed. Consistent footer links across all pages make a positive brand impression.

Optimizes Site Architecture

Including key site-wide pages in the footer provides clues about the website's information architecture. Users can understand the structure and layout of the site sections through well-labeled footer links.

Improves Page Rankings

Adding relevant footer links provides more internal link opportunities which can boost SEO. Quality inbound links to important pages may improve their search visibility and page rankings.

Provides Branding Opportunities

Footers allow branding reinforcement through logos, taglines, social media links etc. Visitors repeatedly see these brand elements each time they scroll down a page.

Enables Legal Disclosures

Important legal pages like Terms of Use, Privacy Policy, Cookie Policy, Copyright Notice can be accessible via footer links. This allows meeting disclosure requirements.

Supports Accessibility Standards

Properly coded footer links enable access for people with disabilities. Adding footer navigation adheres to web accessibility standards like WCAG 2.1.

Implementing Footer Links in Craft CMS

Craft CMS provides several ways to add flexible and customisable footer links throughout a website.

Use Site-Wide Entry Pages

Site-wide entry pages like "Contact" can be added to display a footer link across all pages. The entry title becomes the text link.

Create a Footer Links Structure

A structure section dedicated to footer links enables full control. Links can be manually organized and styled within the structure.

Use Globals

Adding links as Globals makes them editable sitewide from a central place. Globals enable consistency across all footer links.

Embed Footer Navigation

The {% include %} tag can embed a footer nav Twig template on each page. The nav can be reused while tweaked anytime.

Build a Footer Matrix Block

A reusable Matrix block field type containing the footer links is a flexible option. It enables footer customisation per page.

Utilize a Footer Plugin

Plugins like SEOmatic provide out-of-the-box footer link management with many customisation options.

In summary, Craft CMS empowers developers with several strategies to implement custom footer link navigation according to project needs and client goals. A well-planned information architecture approach is key to determine the optimal footer link structure for site usability. Combining Craft's flexible features with web design best practices results in intuitive footer navigation that delights users.

Locating the Footer Template in Craft CMS

Footer Code in Craft CMS

In Craft CMS, the footer code that controls the content and structure of the footer area on pages is contained within a template file called footer.twig.

Craft CMS uses the Twig templating language for its template files. Twig provides a flexible way to output dynamic HTML markup while also enabling access to variables, functions, filters, tags, and more for building frontend templates.

The footer.twig file includes the HTML, CSS, JavaScript, and Twig code needed to render the footer across all the pages of a Craft site. This is where developers can configure the footer by adding in links, widgets, disclaimer text, or anything else that should appear in the footer.

Accessing Template Files

To access the footer.twig file in order to modify the footer markup and links, follow these steps:

  1. Log into the Craft CMS control panel

  2. Go to Settings > Templates

This will open up the Templates page that contains all the .twig template files being used in the site.

The Templates page has a folder structure resembling the templates' location on the front-end. Navigating through these folders will lead to the footer.twig file.

For example, the path on the Templates page may be:

templates > _layouts > base.twig > footer.twig

Opening _layouts/base.twig reveals that this base template file includes the footer template using:

{% include 'footer.twig' %}

Therefore, clicking on footer.twig will open the footer template code in the editor.

Editing the Footer Template

Once the footer.twig file is open in the template editor, developers can modify the footer code as needed.

Some key things that can be edited relating to footer links include:

  • The HTML structure - Add/remove <div> tags or <section> tags to change the footer layout.

  • The CSS styling - Edit existing CSS classes or add new ones to change footer link styling.

  • The Twig code - Update or add Twig tags, variables, macros, etc. to alter footer content.

  • The footer links - Modify the HTML anchor tag <a> attributes like href and link text to change footer links.

  • The page variable - Utilize {{ page.title }} to output dynamic footer links per page.

  • The nav tag - Customize the Twig {% nav %} tag to create a footer navigation structure.

  • The include tag - Change the {% include %} tag to swap out the entire footer template.

Developers should ensure any changes made to footer.twig align with the site's information architecture and user expectations for footer navigation.

Testing edited versions of footer.twig across different site pages is crucial before launching live. TWig errors or incorrect markup can break the entire footer.

Craft CMS empowers complete control over the footer right from the template file. Developers can leverage built-in Twig features and Craft variables to build a custom footer that meets their unique needs.

The key is understanding how to translate design mockups and client requirements into actual Twig code inside footer.twig. With practice, designers and developers can easily tweak Craft's footer.twig to achieve beautiful and functional footer results.

Pro tip: Utilize version control via Git to safely experiment with footer template changes. Versioning footers prevents losing previous code and enables easy rollback.

Editing Templates in Craft CMS

Twig Syntax Overview

Craft CMS uses Twig as its templating language. Twig combines the flexibility of PHP with the readability of HTML markup.

Within Craft CMS templates, Twig code is intermixed with regular HTML code. Some examples of Twig syntax used in templates include:

  • {{ }} - Renders a variable or output. For example: {{ entry.title }} displays the entry's title.

  • {% %} - Denotes logic like if statements, for loops, set variables etc. For example: {% if user %} checks if a user is logged in.

  • {# #} - Comment tag for leaving notes that don't output.

  • | - Applies filters to modify output. For example: {{ date|date('F j, Y') }} formats the date.

Twig enables dynamically generated HTML markup while encapsulating all programming logic within easy-to-read Twig tags.

Developers combine Twig and HTML build the templates that render pages and components in Craft sites. Understanding basic Twig principles is key to editing templates effectively.

Best Practices for Editing Templates

When making changes to Craft CMS templates, follow these best practices:

  • Copy templates before editing - Rather than editing live templates directly, make copies to experiment on first.

  • Use version control - Leverage Git or SVN to track template iterations and easily revert if needed.

  • Test extensively - Validate edits across various pages, entries, devices, and browsers before going live.

  • Check for errors - Fix any Twig syntax errors that could break the site frontend.

  • Clear caches - Clear all frontend and backend template caches after major edits.

  • Keep inline documentation - Add Twig comments explaining any complex template code or new additions.

  • Avoid plugins when possible - For simpler changes, favor native Twig over installing plugins.

Adhering to these practices prevents accidentally breaking templates and enables easier debugging. Backups and testing gives confidence when editing Craft's core Twig templates.

Editing Steps

The general process for making edits to Twig templates in Craft involves:

1. Navigate to the Template File

From the Craft admin, go to Settings > Templates to locate the .twig file.

2. Open the File in the Editor

Click the template file to open it in Craft's editor.

3. Analyze the Existing Code

Review and understand the template's current Twig syntax.

4. Make Changes to Twig and HTML

Edit Twig tags, output variables, HTML elements etc. based on requirements.

5. Save the Template

Save changes by hitting the Save button in the template editor.

6. Preview Edits

View saved changes on the front-end by browsing relevant site pages.

7. Troubleshoot Issues

If pages break, debug errors in Twig syntax or site configuration.

8. Clear Caches

Clear all Twig caches in the Craft admin to see fresh updates.

9. Test Across Site

Thoroughly test edited templates across various pages, content types, and devices.

10. Commit Changes

If satisfied, commit the new template version to version control.

Carefully following these steps mitigates risks when experimenting on live production templates. Small incremental edits are best for fine tuning templates without introducing major regressions.

For large template changes, develop and validate locally first before deploying to production. Environment parity and staging sites help catch issues before they impact end users.

With some discipline, developers can safely tweak Twig templates to unlock more possibilities for unique Craft sites. The key is balancing creativity with stability when altering any frontend-facing code.

Craft grants immense front-end flexibility but also bears responsibility. Thoughtful template upgrades enrich the user experience. Reckless ones disrupt it. Purposeful process triumphs over haphazard hacking.

Adding Link Code to the Footer

HTML Anchor Tag Syntax

The HTML anchor tag <a> is used to create links within web pages and templates. The basic syntax is:

<a href="url">Link Text</a>

The href attribute defines the destination URL that the link points to. This can be an absolute URL like https://example.com or a relative link like /contact.

The text between the opening and closing <a> tags becomes the visible link text that users click on. This text should be descriptive.

Some examples:

<a href="">Craft CMS</a>

<a href="/about-us">About Us</a>

Additional attributes can be added to the anchor tag like target, title, id, class etc. But the key ones for linking are href for the URL and the text between the tags.

The <a> anchor tag provides the essential HTML syntax for adding hyperlinks to web pages, including footer links.

Link Code Example

Here is an example snippet showing how a footer link to the About Us page can be added in HTML:


<div class="footer-links">

<a href="/about-us">About Us</a>



Breaking this down:

  • The <footer> tag contains the footer content.

  • A <div> with class "footer-links" groups the links for styling purposes.

  • The <a href="/about-us">About Us</a> creates the actual text link "About Us" pointing to /about-us.

This structure can be expanded with additional links following the same pattern:

<a href="/contact">Contact</a>

<a href="/terms">Terms</a>

The example demonstrates a simple but effective way to add clickable footer links in HTML markup.

Inserting Link Code

Within the footer.twig template file, footer link code can be directly inserted in the following areas:

  • The main footer <div> - Add links by inserting <a> tags inside the main footer <div> container.

  • A dedicated links <div> - Create a <div> just for links, like "footer-links" in the example above.

  • The {% nav %} tag - Output links from a navigation structure using Craft's {% nav %} tag.

  • A Links <ul> list - List links in an unordered list <ul>. Apply list styling through CSS.

  • A matrix field - Create links as a Matrix block type and output with {% matrix %}.

  • An include - Reuse links defined in a separate _links.twig file included in the footer.

  • A macro - For reusable link sets, define as a Twig macro and insert using {% import %}.

The key is to identify the desired footer link location, then insert valid HTML anchor tag markup or equivalent Twig to output the links.

Testing different link code approaches directly in footer.twig identifies what works best for the site architecture. Striking a balance between maintainability and design is recommended when integrating links.

Overloading the footer with too many intrusive links diminishes the user experience.

Thoughtfully placed unobtrusive links tailored to site goals retains information scent without disrupting visitors. When inserted judiciously, link code upgrades footers from mundane to marvellous.

Setting the Link URL and Text

Link URL Formatting

When adding footer links, properly formatting the URL in the anchor tag's href attribute enhances both user experience and SEO. Use relative internal links starting with / like /contact rather than full URLs to avoid broken links if the domain changes in the future. Link to existing site pages and sections - don't point links to missing 404 pages.

For word separation in URLs, use hyphens such as /privacy-policy instead of spaces. Avoid extremely lengthy or complex URLs when possible. For linking to a PDF document, set the download attribute so the file downloads properly when clicked. To open links in a new tab, add target="_blank" rel="noopener" to the anchor tag. For global site-wide links like Contact and About Us, point to the actual single entry page containing that content. Adhering to these best practices for formatting link URLs results in smooth, intuitive footer navigation.

Link Text Guidelines

Optimizing the anchor text inside the <a> tags substantially improves footer link usability. The text should be succinct yet descriptive, summarizing the essence of the linked page while getting across its gist.

Use title case capitalization and capitalize the first letter of each main word. Avoid generic filler text like "Click here" and instead label links clearly. Keep link text short, ideally 1-5 words, to avoid unnecessarily long confusing phrases. Be consistent with internal anchor text patterns and use similar text for common pages like About Us and Contact.

Also consider search intent when writing link text, and incorporate relevant keywords site visitors may use when searching. Well-written link text provides clear cues about expected content, engendering trust in footer links.

Link Text vs URL Examples

Some examples illustrate properly formatted footer link URLs and corresponding descriptive anchor text:

About Us /about-us

Contact Us /contact

Privacy Policy /privacy-policy

Return Policy /returns-policy

Download Catalog /files/catalog.pdf (with download attribute)

Follow on Instagram https://instagram.com/company (opens in new tab)

The link text summarizes each page's content while the URLs use relative internal links with hyphens for word separation. Special cases like PDFs and external sites handle the URLs accordingly. Concise, engaging link text coupled with properly structured URLs transforms footers from dull space-fillers into intuitive site maps guiding visitors seamlessly.

Adding Multiple Links to the Footer

Repeating Link Insertion

Expanding the footer links beyond a single link simply involves repeating the anchor tag insertion process for each new link. Determine the additional pages to link to, format the URLs properly following best practices, write clear and concise anchor text, and insert new <a> tags into the footer div. Separate links visually for styling purposes using a pipe | or line break <br>.

For example:

<a href="/about-us">About Us</a> | <a href="/contact">Contact</a> |\ <a href="/privacy-policy">Privacy Policy</a>

Rinse and repeat this process to continuously grow the footer link structure by inserting more properly formatted anchor tags.

Organizing Footer Links

When adding multiple footer links, organization and presentation dramatically impacts usability.

Logically group related links together under labeled div sections. Prioritize the most important links first in each section. Visually separate external off-site links from internal links. Place utility links like Contact and Sitemap at the end. Arrange links into columns to optimize footer space on the page. Maintain consistent link grouping across device viewports. Semantic organization reinforces site structure through clear relationships.

Link Placement

Optimal link placement enhances discoverability. Place links above the copyright notice for visibility. Keep links a balanced distance from page edges and stick to a consistent layout across breakpoints. Right-aligned links provide a clean appearance. Position links in proximity to associated content like social media. Leave whitespace around links for clean spacing. Order links by relevance rather than arbitrarily. Purposeful placement aligns with how users scan the footer and associates links with surrounding elements through subtle visual cues.

In summary, constructing a robust footer link structure requires repeating the insertion process while strategically organizing and intentionally placing links to maximize usability and reinforce site architecture. Subtle details distinguish thoughtfully crafted content pathways from an average heap of footer links.

Troubleshooting Footer Links

Testing Links

Thoroughly testing all footer links after implementation identifies issues before launch. Click every link on every page to verify proper redirection and match inline text to opened pages. Check styling consistency across links on all site templates including homepage, interior, blog, etc. Confirm mobile, tablet and desktop functionality across viewports. Validate cross-browser operability on Chrome, Firefox, Safari. Enable accessibility testing to inspect focus states. Pass links through validation tools like W3C Link Checker to catch errors. Perform site crawls to uncover any broken links. Rigorous validation early on surface problems.

Identifying Link Issues

Stay observant during testing to catch common footer link defects like dead 404 links, incorrect redirection, inaccurate anchor text, inconsistent styling colors, illogical placement order, overlapping links, non-functioning links on certain templates, and invisibility on mobile. Also watch for invalid HTML code causing display issues. Being hyper vigilant identifies faulty links.

Debugging and Fixing Links

Meticulously debug link problems by checking href URLs, inspecting HTML markup validity, reviewing CSS styling consistency, and examining layout across devices. Reorder illogical structures. Update mismatched anchor text. Fix 404s by redirecting to active pages. Adjust spacing to eliminate overlap. Correct invalid HTML. Precisely isolating the underlying issue then surgically repairing enables smooth, seamless footer navigation.

In summary, comprehensive footer link testing, keen-eyed issue identification, and meticulous debugging crafts an optimal experience. Proactive validation prevents a faulty footer from leading visitors astray down the line.

Footer Link SEO Best Practices

Optimizing Anchor Text

Anchor text optimization is vital for footer link SEO. Use keyword-rich anchor text where appropriate to increase relevance. Naturally incorporate target keywords and related semantic phrases in footer link text. Include conversational long-tail variations for a human feel. Ensure coherent topic-wise anchor text across links. Strike a balance between optimization and readable text. Well-optimized semantic anchor text reinforces footer links as pathways to topical, relevant content for both users and search engines.

Using Target Keywords

When integrating target keywords into anchor text, study top-ranking competitor links for inspiration. Prioritize primary, secondary, LSI, and misspelled keywords. Prominently place keywords at the start of links. Add location and category keywords for local SEO. Vary anchor text using synonyms and related phrases. Avoid over-optimization by incorporating keywords judiciously. For example, "Store Locations in London" and "Contact Our Sales Team" work in relevant keywords naturally without awkwardness.

Link Organization

Logical footer link organization benefits SEO. Group related content section links together. Arrange links from most to least important. Place keyword-optimized links prominently.

Maintain proximity between connected links for contextual signals. Use headings like "Services" and "Company" to label sections. Keep organization consistent across device viewports. Purposeful grouping, order, and placement signals relevance both internally and to search engines. For example, separate links into logical sections like Services Links, Company Links, and Support Links. Semantic structure reinforces architecture while benefiting SEO.

In summary, optimizing anchor text, integrating keywords, and organizing footer links boosts relevance without sacrificing user experience. Subtle SEO enhancements create intuitive pathways guiding visitors precisely to intended destinations.

Shape April 2022 HR 202
Andy Golpys
- Author

Andy has scaled multiple businesses and is a big believer in Craft CMS as a tool that benefits both Designer, Developer and Client. 

Show us some love
Email Us
We usually reply within 72 hours
Agency Directory
Submit your agency
Affiliate Partners
Let's chat