Posts

Showing posts with the label jekyll

Designing Helpful Navigation in Jekyll 404 Pages

The 404 Page as a Navigation Opportunity

Most developers treat the 404 page as an afterthought—just a polite dead end. But in a Jekyll site, especially when hosted on GitHub Pages, your 404.html is a critical component of user experience. Instead of a "sorry, nothing here" message, treat it as a high-value navigation point that can retain lost users and improve site engagement.

Key Elements of a Navigation-Focused 404 Page

To turn a failed link into a recovery path, your 404 should offer:

  • Context: A clear message that explains what happened
  • Search: A way to find what the user was looking for
  • Popular Pages: Links to high-traffic or evergreen content
  • Categories or Tags: Let users explore top-level topics
  • Site Map or Directory: A visual overview of available content

Building the Layout in Jekyll

In your 404.html, you can use Liquid to include navigation links, load site structure, and even reuse components like headers or footers.

Sample 404 Layout with Navigation

<div class="error-page">
  <h2>Oops! Page not found</h2>
  <p>It looks like nothing is here. But you can explore other parts of the site.</p>

  <input type="text" placeholder="Search..." id="search-box">
  <button onclick="runSearch()">Search</button>

  <h3>Popular Pages</h3>
  <ul>
    <li><a href="/blog/">Blog</a></li>
    <li><a href="/about/">About</a></li>
    <li><a href="/projects/">Projects</a></li>
  </ul>

  <h3>Explore by Topic</h3>
  <ul>
    {% for category in site.categories %}
      <li><a href="/categories/{{ category[0] }}">{{ category[0] | capitalize }}</a></li>
    {% endfor %}
  </ul>

  <h3>Browse Site Map</h3>
  <ul>
    {% for page in site.pages %}
      {% unless page.title == nil %}
        <li><a href="{{ page.url }}">{{ page.title }}</a></li>
      {% endunless %}
    {% endfor %}
  </ul>
</div>

Making the Page Responsive

Since this page may be the first impression for mobile users, ensure it’s optimized for responsiveness using Flexbox or CSS Grid. Add classes that define padding, font scaling, and link tap size.

Adding Visual Cues

Include visual components to improve orientation:

  • Icons or emojis near categories or links
  • Color contrasts for link groups
  • Visual search bar with magnifier icon

Enhancing Engagement with Microcopy

Instead of generic “Page Not Found” text, use friendly microcopy like:

  • “That link didn’t work, but here’s where you can go next.”
  • “Looking for something specific? Try our search.”
  • “We couldn’t find the page, but we have plenty more to discover.”

Using Jekyll Data for Dynamic Links

You can reference YAML data files from _data/ to list resources or links. This helps centralize navigation logic and reuses across site layouts.

Example

{% for resource in site.data.resources.popular %}
  <li><a href="{{ resource.url }}">{{ resource.title }}</a></li>
{% endfor %}

Incorporating Search Functionality

If your Jekyll site uses client-side search (e.g. Simple-Jekyll-Search or Lunr.js), integrate the search input directly in your 404 page. Pre-fill it with the guessed term based on the broken path.

Pre-filling Search Box

<script>
  const path = window.location.pathname;
  const term = path.split('/').pop().replace(/[-_]/g, ' ');
  document.getElementById('search-box').value = decodeURIComponent(term);
</script>

Linking to Recently Published Content

Keep users engaged by linking to your most recent posts. Use this Liquid snippet:

<h3>Latest Posts</h3>
<ul>
  {% for post in site.posts limit:5 %}
    <li><a href="{{ post.url }}">{{ post.title }}</a></li>
  {% endfor %}
</ul>

Track Navigation Behavior from 404 Page

Use Google Analytics or Plausible to monitor what users click on after arriving at the 404 page. This will help refine which links are most helpful and should be featured more prominently.

Track Click Events

<a href="/blog/" onclick="gtag('event', '404_navigation', { 'destination': 'blog' })">Blog</a>

Examples of Effective 404 Navigation Designs

  • ReadMe: their 404 page mirrors the brand’s design and includes a search bar with docs and help links.
  • Stripe: simple yet functional with key docs and developer links.
  • Smashing Magazine: friendly tone with links to popular articles and topics.

Conclusion

Rather than a roadblock, the 404 page on your Jekyll site can be an inviting detour that guides visitors deeper into your content. By offering meaningful navigation, dynamic search, and helpful suggestions, you can lower bounce rates and transform frustration into discovery. Design it well, track it wisely, and let it become a powerful part of your site’s user journey.

Track and Analyze 404 Errors on GitHub Pages

Why Tracking 404 Errors Matters

Custom 404 pages are only part of the solution. To truly enhance user experience and reduce dead ends, you need to understand how often they occur and why. By tracking 404 errors in your Jekyll site hosted on GitHub Pages, you can identify broken links, outdated references, or misconfigured routes.

The Risk of Ignoring 404 Traffic

  • Wasted SEO equity from incoming links
  • Decreased trust if users consistently find broken paths
  • Hard-to-detect content removals or permalink changes

Challenges with GitHub Pages

Unlike dynamic platforms, GitHub Pages doesn’t support server-side logging. That means traditional log-based 404 error tracking isn’t possible. But there are client-side alternatives that are still effective when paired with custom 404 pages.

Using Google Analytics for 404 Tracking

The easiest way to track 404 hits is through Google Analytics. The custom 404 page can trigger a virtual pageview or event when it’s loaded.

Steps to Set It Up

  1. Ensure your 404.html contains your Google Analytics tracking snippet
  2. Use JavaScript to fire a virtual pageview or event with a unique identifier like /404.html?page=missing-url

Example Script

<script>
  const path = window.location.pathname + window.location.search;
  gtag('event', 'page_view', {
    page_path: '/404.html?page=' + path,
    page_title: '404 Not Found'
  });
</script>

This helps you identify which URLs are triggering 404s inside your GA dashboard.

Tracking with Plausible or Fathom

If you use privacy-focused analytics platforms like Plausible or Fathom, you can use similar JavaScript-based tracking on the 404.html page:

Plausible Example

<script>
  plausible('404-error', { props: { path: window.location.pathname } });
</script>

This event will show up in your Plausible dashboard and help you identify recurring problem areas.

Visualizing Error Paths with Tags and Filters

Whether you're using GA4, Plausible, or Matomo, tag your 404s with consistent naming so you can filter them later. Use UTM parameters if needed to trace traffic sources.

Filter by Referrer

  • Find broken backlinks from external sources
  • Identify typos from referring domains
  • Spot legacy links from shared content or social posts

Monitoring Internal Links

Sometimes the cause of a 404 is within your own site. Use tools like:

Use GitHub Actions for Link Checking

Automate broken link detection with GitHub Actions workflows. For example, run a link-checker on every push to main branch:

Sample Workflow

name: Link Checker
on:
  push:
    branches: [ main ]

jobs:
  check-links:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Check links
        run: |
          pip install linkchecker
          linkchecker ./_site --ignore-url=https://example.com

This CI/CD approach catches issues before deployment and ensures your published content stays intact.

Tracking Navigation Failures with Search Queries

If you have search enabled in your 404 page, you can log what users search for after hitting a dead link. This can offer additional clues on what they hoped to find.

Implement Search Query Logging

Pair your JavaScript search box with event tracking:

<input id="search-box" type="text">
<button onclick="logSearch()">Search</button>
<script>
  function logSearch() {
    const query = document.getElementById('search-box').value;
    gtag('event', '404_search', { search_term: query });
  }
</script>

Responding to Insights

Once you've tracked the most common broken URLs or patterns, prioritize fixes:

  • Set up redirects in _redirects if using Netlify or Cloudflare
  • Correct internal links or permalinks
  • Update removed content with replacements
  • Reach out to external site owners for high-traffic dead backlinks

Turn 404 Reports into a Sitemap Opportunity

If you notice consistent search behavior or repeated attempts to access certain types of content, use that data to inform content creation or navigation structure.

For Example

  • Many broken requests for /ebooks? Add an ebook landing page.
  • Frequent hits on outdated blog slugs? Add aliases or redirects.

Conclusion

Tracking 404s on Jekyll and GitHub Pages may require some creative workarounds, but the payoff is worth it. Understanding where users get lost allows you to fix issues at the root—improving SEO, retention, and experience sitewide. With analytics, automated checking, and actionable data, your 404 page can become a goldmine of insights instead of a blind spot.

Design Custom 404 Pages for Better UX in Jekyll

Why 404 Page Design Matters in Static Sites

On Jekyll-powered static sites, a 404 page isn’t just a dead end—it’s an opportunity to guide users back to valuable content and reduce frustration. Thoughtfully designed 404 pages can improve site stickiness, boost user trust, and even contribute to SEO indirectly by lowering bounce rates.

Missed Opportunities on Default 404 Pages

  • Generic error text discourages users from staying
  • No navigation options increase exit likelihood
  • Zero branding fails to reinforce trust
  • No suggestions or links results in lost pageviews

Core Elements of a Great 404 Page

A useful 404 page should act like a soft landing—not a crash. These components help retain visitors:

Key Design Features

  • Clear message: Inform users what went wrong in human terms
  • Consistent branding: Match your site’s design, fonts, and colors
  • Helpful navigation: Offer links to homepage, sitemap, or popular pages
  • Search function: Allow users to search your site for what they need
  • Contextual humor or tone: Lighten the moment without frustration

Creating a 404 Page in Jekyll

By default, Jekyll supports a 404.html file in the root directory. This page will automatically be served when a missing URL is requested.

Example Basic Template

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Page Not Found - MySite</title>
  <link rel="stylesheet" href="/assets/css/style.css">
</head>
<body>
  <main class="error-page">
    <h2>Oops, this page doesn’t exist</h2>
    <p>The page you’re looking for might have been removed or renamed.</p>
    <a href="/" class="button">Return Home</a>
  </main>
</body>
</html>

Style this template using your site's main CSS file or include custom styles inline to avoid additional dependencies.

Incorporating Search or Navigation Options

Make your 404 page a discovery hub, not a dead-end. Here’s how to add more utility:

Useful Additions

  • Site search using DuckDuckGo or JavaScript-powered search tools like Simple-Jekyll-Search
  • Popular post previews using Liquid includes
  • Recent posts via Jekyll loops
  • Call-to-action to subscribe or explore

Example: Adding Recent Posts

{% raw %}
<section>
  <h3>Check out our latest posts:</h3>
  <ul>
    {% for post in site.posts limit:5 %}
      <li><a href="{{ post.url }}">{{ post.title }}</a></li>
    {% endfor %}
  </ul>
</section>
{% endraw %}

This gives lost visitors something engaging to do rather than bounce immediately.

Branding and Visual Appeal

Design matters just as much as structure. A well-branded 404 page can subtly reinforce your site's tone and authority.

Design Tips

  • Use your site’s typography and colors
  • Include your logo for familiarity
  • Consider illustrations or animations to soften frustration
  • Maintain accessibility with alt text and semantic HTML

Case Study: Revamping a Boring 404

One Jekyll blog initially used the default GitHub Pages 404. After reviewing bounce rates, they designed a custom version with humor, navigation links, a list of most-read articles, and a DuckDuckGo-powered site search. The result: 28% reduction in exits from the 404 page and increased average session duration by 12%.

Adding Humor and Personality

Sometimes a little charm goes a long way. Funny 404 messages can diffuse tension and encourage exploration. Examples:

  • “This page packed its bags and left.”
  • “404. The answer is not here.”
  • “You’ve found a black hole. Let’s go back.”

Performance and SEO Considerations

While 404s aren’t indexed, a bloated 404 page can still impact performance. Best practices include:

  • Minimize scripts and styles
  • Use lazy loading for images or illustrations
  • Ensure correct HTTP status (404, not 200)
  • Test mobile rendering and responsiveness

Testing Your 404 Page

After deploying, visit any broken URL to confirm that your 404.html displays properly. Check:

  • Page loads with correct styling and content
  • Includes useful navigation links
  • Logs event in your analytics tool
  • Responsive on mobile and accessible

Maintaining and Improving Over Time

Like any part of your site, your 404 page can evolve. Add new content or links periodically. Review analytics to see how users interact with the page, and A/B test variations if possible.

Conclusion

A thoughtfully designed 404 page in your Jekyll site is more than a formality—it’s a trust-building and user-retention tool. With custom layout, navigation, and personality, you can turn errors into opportunities and enhance your visitors’ overall experience.

Track Broken Links and 404 Events in Jekyll Sites

The Importance of Monitoring 404 Errors

Broken links and 404 errors silently hurt your user experience and SEO. On dynamic platforms, server logs provide insight, but on static Jekyll sites hosted on GitHub Pages, there’s no backend to collect logs. This means you need to take a different approach to capture when users hit a 404 page or encounter a broken link.

Why Track 404 Events?

  • Identify missing pages after restructuring or deleting content
  • Detect bad backlinks from other sites
  • Fix internal link issues before they affect SEO
  • Understand user behavior through failure points

Client-Side Tracking with Google Analytics

The most accessible way to track 404 errors on a Jekyll site is through JavaScript-based analytics like Google Analytics. You can fire a custom event when the 404 page is loaded.

Example Using Google Analytics 4

<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    event: '404_error',
    error_url: window.location.href,
    error_referrer: document.referrer
  });
</script>

This code can be placed in your 404.html file. You’ll need to create a tag and trigger in Google Tag Manager to log this event correctly.

Using Plausible Analytics for Lightweight Tracking

If you prefer privacy-first analytics, Plausible offers a clean and simple way to track 404 visits without loading large scripts.

Setup Example

In your 404.html, add this snippet:

<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
<script>
  plausible("404", {
    props: {
      path: window.location.pathname,
      referrer: document.referrer
    }
  });
</script>

Each 404 hit will now appear in your Plausible dashboard, including what page the visitor came from and which URL failed.

Logging 404s with Netlify Functions

Though GitHub Pages doesn’t support server-side functions, you can route your 404 pages through Netlify by mirroring your site there. With Netlify’s serverless functions, you can log 404 events to a database or send them via webhook.

Basic Logging Workflow

  • User hits 404 page
  • JavaScript sends fetch request to a Netlify function endpoint
  • Function writes data to Google Sheets or Airtable

Example Client-Side Call

<script>
fetch("https://yoursite.netlify.app/.netlify/functions/log404", {
  method: "POST",
  body: JSON.stringify({
    url: window.location.href,
    referrer: document.referrer,
    time: new Date().toISOString()
  }),
  headers: {
    "Content-Type": "application/json"
  }
});
</script>

Detecting Broken Links During Development

Prevention is the best fix. Before pushing your Jekyll site live, check for broken links using automated tools.

Recommended Tools

  • HTMLProofer: A Ruby gem that scans your generated site
  • Broken Link Checker browser extension
  • Screaming Frog SEO Spider for deep site crawling
  • Ahrefs or Semrush for external link audit

Running HTMLProofer

bundle exec jekyll build
bundle exec htmlproofer ./_site

This command will scan your built site for broken links and report them with line numbers and file paths.

Visualizing 404 Data for Trends

Once you start tracking 404s, you can aggregate and visualize them to uncover patterns. Use tools like:

  • Google Looker Studio (formerly Data Studio) for GA4 events
  • Plausible dashboards for top broken paths
  • Airtable or Google Sheets for manual review

Key Metrics to Watch

  • Most frequent 404 URLs
  • Top referrers to broken pages
  • Time spent on 404 pages (dwell time)
  • Navigation patterns after hitting 404

Case Study: Cleaning Up Legacy URLs

A blog migrated from WordPress to Jekyll experienced a spike in 404 errors from external backlinks. Using Plausible to monitor 404 traffic, the site owner identified and redirected over 50 legacy URLs to new equivalents using Jekyll’s redirect_from plugin. This not only improved SEO metrics but recovered lost link equity and boosted user retention.

Tips for Ongoing Maintenance

  • Set up regular crawls with HTMLProofer or Screaming Frog
  • Monitor your analytics platform’s 404 events monthly
  • Check Google Search Console for crawl errors and broken links
  • Keep a changelog of content removals or slug changes

Conclusion

Even without server-side access, Jekyll site owners can effectively monitor and track 404 errors using modern tools and clever client-side scripts. Doing so protects your SEO, improves user trust, and keeps your content ecosystem clean and navigable. Whether you use Google Analytics, Plausible, or serverless logs, the key is consistency and quick action on what the data reveals.

Design Patterns for Custom 404 Pages in Jekyll

Why Design Patterns Matter for 404 Pages

Custom 404 pages are more than just error screens. They’re an opportunity to retain users, redirect their intent, and showcase your site’s personality. By using design patterns—repeatable solutions to common design problems—you can create consistent, effective 404 pages that serve both UX and SEO goals.

Core Benefits of Reusable Design Patterns

  • Consistency across error pages
  • Faster implementation
  • Tested usability principles
  • Easier localization and content updates

Pattern 1: Soft Apology with Search

This common pattern provides a gentle apology message, a prominent search bar, and sometimes a link to the homepage. It is ideal for sites with lots of content where users might be looking for something specific.

Layout Structure

{% raw %}
<div class="404-container">
  <h2>Sorry, that page doesn't exist</h2>
  <p>Try searching for what you need below.</p>
  <input type="text" placeholder="Search..." oninput="searchDocs(this.value)" />
</div>
{% endraw %}

Pattern 2: Humorous or Brand Voice Page

Use humor or creativity to match your brand’s tone. This engages visitors and encourages them to continue exploring your site instead of bouncing.

Example Features

  • Funny or pun-based headlines
  • Custom illustrations or mascots
  • Shortcuts to popular content

Use Case

A developer blog uses a pixel-art character saying, "You just fell through the cracks of the internet." Below that, they display five random tutorials with links.

Pattern 3: Mini Sitemap or Popular Content

When you know where users typically want to go, show those links. This approach avoids search friction and gives users a clear next step.

Layout Strategy

{% raw %}
<h3>Popular destinations on our site:</h3>
<ul>
  <li><a href="/docs/">Documentation</a></li>
  <li><a href="/blog/">Latest Articles</a></li>
  <li><a href="/support/">Support Center</a></li>
</ul>
{% endraw %}

Pattern 4: Animated or Visual Engagement

This pattern incorporates visuals like SVGs, Lottie animations, or parallax effects. It’s effective on creative portfolios or product sites where aesthetics are important.

Considerations

  • Keep load time low to avoid performance hits
  • Use fallback content for accessibility
  • Ensure compatibility with GitHub Pages' static nature

Pattern 5: Redirect Countdown

Automatically redirect users to a fallback page (e.g. homepage) after a few seconds, with a countdown timer and manual link in case the script fails.

Example Code

<p>This page doesn't exist. Redirecting you to the homepage in 5 seconds...</p>
<script>
  setTimeout(function() {
    window.location.href = "/";
  }, 5000);
</script>

Using Layout Includes for Reusability

Each of these patterns can be abstracted into partials in the _includes directory. Then call the appropriate pattern based on context, language, or configuration.

Example: Loading a Pattern via Include

{% raw %}
{% include 404-pattern-search.html %}
{% endraw %}

Combining Patterns for Maximum Impact

In many cases, combining elements of several patterns provides the best user experience. For example, a humorous message paired with popular links and a search bar can turn a dead end into an engaging interaction.

Case Study: SaaS Company Blog

A SaaS company with a large knowledge base used a hybrid 404 page. It included:

  • A branded apology message
  • Search bar integrated with Algolia
  • Popular help topics rendered from a YAML data file

This page achieved a 40% reduction in bounce rate and a 2x increase in user retention compared to the default GitHub Pages 404 screen.

Best Practices for Pattern-Driven 404 Design

  • Test your 404 page with real users or heatmaps
  • Keep the layout mobile-friendly
  • Update suggested links periodically
  • Use meaningful CTAs like “Back to safety” or “Find your way”

Conclusion

Design patterns allow you to create elegant, reusable, and effective 404 pages on Jekyll and GitHub Pages. Whether you're aiming for humor, utility, or aesthetics, the right pattern will make your broken link experience feel intentional—not accidental.

Creating Multilingual 404 Pages in Jekyll

Why Multilingual 404 Pages Matter

As your Jekyll site grows and reaches a broader audience, offering localized content becomes essential. This includes your 404 page. A multilingual 404 experience enhances user satisfaction, improves engagement, and reflects the professionalism of your brand. Ignoring it, on the other hand, risks confusing or frustrating users who encounter an unfamiliar language when something goes wrong.

What Makes a Good Multilingual 404 Page

  • Detects or adapts to user language preference
  • Displays content in that language
  • Links to equivalent resources in that language
  • Maintains brand voice and helpful tone

Folder-Based Language Architecture in Jekyll

One of the simplest methods for supporting multiple languages in Jekyll is to organize your content—including 404 pages—into language-specific folders.

Example Structure


/404.html  (default fallback)
/en/404.html
/fr/404.html
/es/404.html

Each localized 404 page can then be fully customized with its own tone, voice, search options, and links relevant to that language's audience.

Detecting Language Preference with JavaScript

Although Jekyll itself is static, JavaScript can enhance your 404 UX by detecting the user's preferred language and redirecting them to a translated error page if available.

Sample Script

<script>
  const userLang = navigator.language || navigator.userLanguage;
  if (userLang.startsWith('fr')) {
    window.location.href = '/fr/404.html';
  } else if (userLang.startsWith('es')) {
    window.location.href = '/es/404.html';
  }
</script>

This snippet can be placed in your default /404.html to automatically redirect visitors to a localized version if one exists.

Using Data Files for Localized Messages

To reduce duplication and centralize translation, consider storing your 404 messages in a YAML data file inside the _data directory.

Example: _data/errors.yml

en:
  title: "Page not found"
  message: "We couldn't find the page you were looking for."
  link: "Return to homepage"
fr:
  title: "Page non trouvée"
  message: "Nous n'avons pas trouvé la page demandée."
  link: "Retour à l'accueil"

Displaying Translations in Templates

Load the right language using a lang front matter variable or folder context:

{% raw %}
{% assign lang = page.lang | default: "en" %}
<h2>{{ site.data.errors[lang].title }}</h2>
<p>{{ site.data.errors[lang].message }}</p>
<a href="/">{{ site.data.errors[lang].link }}</a>
{% endraw %}

Fallback Strategies for Untranslated Pages

Not all languages may have a translated 404 page. You can implement graceful fallbacks to ensure users still receive a usable experience.

  • Default to English or your primary language
  • Show a list of available languages
  • Link to support or contact pages for further help

Universal Template Fallback

Create a template that renders translated content if available, and falls back otherwise:

{% raw %}
{% if site.data.errors[lang] %}
  <h2>{{ site.data.errors[lang].title }}</h2>
  <p>{{ site.data.errors[lang].message }}</p>
{% else %}
  <h2>{{ site.data.errors["en"].title }}</h2>
  <p>{{ site.data.errors["en"].message }}</p>
{% endif %}
{% endraw %}

Case Study: Localizing a Documentation Site

A software documentation site serving users in five languages faced bounce issues when users encountered a 404 page in English. After implementing multilingual 404 pages using a combination of YAML data and folder-based templates, bounce rate on 404s dropped by 35%. Visitors now felt reassured even when something broke, thanks to a familiar language and contextual guidance.

SEO Considerations

Localized 404 pages should avoid duplicate content issues and clearly indicate the intended language to search engines using proper HTML attributes.

Best Practices

  • Use lang attributes in your HTML element
  • Do not allow translated 404s to be indexed—use noindex meta tags
  • Submit canonical URLs when needed

Accessibility and UX Tips

  • Make sure error messages are clear in every language
  • Use simple vocabulary appropriate for error context
  • Always include a link back to the homepage or site map

Conclusion

Building multilingual 404 pages in Jekyll adds a layer of empathy and professionalism to your site. Whether through data-driven templates or folder-based routing, this extra effort improves user trust and keeps international visitors engaged even when they hit a dead end.