bridgetownrb / bridgetown-seo-tag

A Bridgetown plugin to add metadata tags for search engines and social networks to better index and display your site's content.
MIT License
29 stars 8 forks source link

meta description for posts #7

Closed a-chris closed 1 year ago

a-chris commented 1 year ago

Hi everyone, first of all, thank for your work, Bridgetown is a bless to use.

I'm using Bridgetown to build a personal blog and I have a question about using the post description to fill the meta description for post pages. From what I understand, the README says that this should work automatically just by adding a description in the front matter of a post.

However, when I write posts with description in the front matter, the meta description generated always displays the site_metadata.description instead. I've tried including the <%= seo %> tag inside the post, but it didn't work. I'm using ERB in case it matters.

my front matter:

---
layout: post
title: Marseille travel
date: 2023-05-06 18:42:33 +0200
categories: updates
image: /images/marsiglia.jpg
description: Low cost travel to Marseille
---

Could you please help me to understand what I'm doing wrong? Perhaps I've misunderstood the README?

a-chris commented 1 year ago

UPDATE: after a few attempts I figured out the problems, for who comes to this issue in the future:

  1. I was using <% seo %> instead of <%= seo %>
  2. the <%= seo %> should be put in the _head.erb partial
  3. remove any other <meta description or title from the head partial

now it's working 🥳 feel free to close this issue