Explore More Passive Income Ideas

add search to jekyll without javascript frameworks

Why Use Native Search for Jekyll Most Jekyll blogs rely on static content, which makes traditional database-driven search impossible. However, you don’t need heavy JavaScript frameworks like Vue or React to implement search. By leveraging JSON, Liquid, and a bit of vanilla JavaScript, you can create a responsive search experience that works on any static host—even GitHub Pages. Core Concepts Here’s the approach we’ll take: Generate a JSON index of your posts during build time Load the JSON file with plain JavaScript Match user input against title and content Display matching posts as results dynamically Step 1: Create a Search Index in JSON Add a new file called search.json at the root of your project: --- layout: null --- [ {% raw %}{% for post in site.posts %} { "title": "{{ post.title | escape }}", "url": "{{ post.url | absolute_url }}", "date": "{{ post.date | date: '%Y-%m-%d' }}...

automated meta tags for better seo in jekyll

Why Meta Tags Matter in Jekyll SEO

Meta tags help search engines and social media platforms understand what your page is about. While Jekyll is a static site generator, it provides flexibility to inject dynamic meta tags using Liquid templates. This is essential for:

  • Improved indexing and relevancy in search results
  • Higher click-through rates from enticing social previews
  • Control over duplicate content and canonical URLs

Setting Up Meta Tags in Jekyll

Meta tags should be managed in a centralized include file—typically in _includes/head.html. This makes your setup maintainable and modular.

Sample Dynamic Meta Tags Setup

<title>
  {% if page.title %}
    {{ page.title }} | {{ site.title }}
  {% else %}
    {{ site.title }} - {{ site.description }}
  {% endif %}
</title>

<meta name="description" content="{% if page.description %}{{ page.description }}{% else %}{{ site.description }}{% endif %}">
<meta name="author" content="{{ page.author | default: site.author }}">

<link rel="canonical" href="{{ page.url | absolute_url }}">

Using Site and Page Variables

Jekyll lets you define global variables in _config.yml and page-level variables in each post or page's front matter. Example:

# _config.yml
title: "My Blog"
description: "Evergreen strategies for digital growth"
author: "Admin"
# post.md
---
title: "Automated Meta Tags for Better SEO in Jekyll"
description: "Discover how to automate meta tags and Open Graph data in Jekyll to boost your blog's on-page SEO performance."
author: admin
---

Adding Open Graph and Twitter Card Support

To make your posts look good when shared, add Open Graph tags and Twitter Cards in _includes/head.html.

Open Graph Markup

<meta property="og:title" content="{{ page.title | xml_escape }}">
<meta property="og:description" content="{{ page.description | xml_escape }}">
<meta property="og:type" content="article">
<meta property="og:url" content="{{ page.url | absolute_url }}">
<meta property="og:site_name" content="{{ site.title }}">

Twitter Cards

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ page.title }}">
<meta name="twitter:description" content="{{ page.description }}">
<meta name="twitter:site" content="@yourhandle">

Fallback Logic with Liquid

Using Liquid conditionals, you can ensure that your meta tags never break. Always check if the page-specific variable exists, and fall back to site-wide defaults if not:

<meta name="description" content="{% if page.description %}{{ page.description }}{% else %}{{ site.description }}{% endif %}">

Including Images in Social Metadata

For better preview on social media, add image meta tags. You can specify a featured image in each post’s front matter:

# post.md
image: /assets/images/meta-image.jpg
<meta property="og:image" content="{{ page.image | absolute_url }}">
<meta name="twitter:image" content="{{ page.image | absolute_url }}">

Organizing Meta Tag Includes

Split your meta logic into smaller includes if necessary. For example:

  • _includes/meta-description.html
  • _includes/open-graph.html
  • _includes/twitter-card.html

Then include them inside your main _includes/head.html file.

Final Meta Tag Strategy Checklist

  • Each post/page has a unique title and description
  • Use og:image and twitter:image for previews
  • Include canonical URLs to prevent duplicate issues
  • Test your setup with Facebook’s Sharing Debugger and Twitter Card Validator

Conclusion

Automating your meta tags in Jekyll makes your blog more consistent, professional, and SEO-ready. With minimal Liquid logic and a smart template setup, you can ensure every page and post performs optimally for search engines and social sharing. It's a one-time investment that pays long-term dividends in traffic and visibility.


Archives / All Content


© ScrollBuzzLab . All rights reserved.