Skip to content

Conversation

dimaslanjaka
Copy link

add modified date meta tag, useful for SEO

Copy link
Contributor

@CookiePLMonster CookiePLMonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin, as well as jekyll-feed, make use of page.last_modified_at. It would make more sense to use this instead of page.updated. This way the SEO tag would match what jekyll-feed outputs:
https://github.com/jekyll/jekyll-feed/blob/43cc5d51e30b59ab8d8ba970e42c8c437e2b233f/lib/jekyll-feed/feed.xml#L78

@ashmaroli otherwise this looks good I think? Pinging you directly as per a comment in #512 (comment) - despite not being the author of this PR, I wish to signal there is interest in this plugin.

@ashmaroli
Copy link
Member

I agree with @CookiePLMonster here. It would be better to use the last_modified_at attribute here for party between generated feed and SEO markup.

@CookiePLMonster
Copy link
Contributor

CookiePLMonster commented May 1, 2025

Furthermore, even in this plugin, page.last_modified_at is already used for LD-JSON generation:

context "date modified" do
let(:config) { { "timezone" => "America/New_York" } }
context "with seo.date_modified" do
let(:page_meta) { { "seo" => { "date_modified" => "2017-01-01" } } }
it "uses seo.date_modified" do
expect(subject.date_modified).to eql("2017-01-01T00:00:00-05:00")
end
end
context "with page.last_modified_at" do
let(:page_meta) { { "last_modified_at" => "2017-01-01" } }
it "uses page.last_modified_at" do
expect(subject.date_modified).to eql("2017-01-01T00:00:00-05:00")
end
end

Example from my website:

<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"Silent"},"dateModified":"2025-04-23T13:30:00+00:00","datePublished":"2025-04-23T13:30:00+00:00"

@CookiePLMonster
Copy link
Contributor

CookiePLMonster commented May 1, 2025

@ashmaroli Looking at

def date_modified
@date_modified ||= begin
date = page_seo["date_modified"] || page["last_modified_at"].to_liquid || page["date"]
filters.date_to_xmlschema(date) if date
end
end
def date_published
@date_published ||= filters.date_to_xmlschema(page["date"]) if page["date"]
end
, the current article:published_time isn't exactly great either and instead it should be seo_tag.published_time - it's used for LD-JSON already, but not for the HTML template. I can prepare an alternative PR tomorrow correcting this + modification date.

@CookiePLMonster
Copy link
Contributor

Additionally, this duplicates #447, albeit using last_modified_at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants