From 1f6ff62cae08e941051aae03fc989bfacc9c2343 Mon Sep 17 00:00:00 2001 From: Arpad Muranyi Date: Fri, 20 Mar 2026 10:29:00 +0100 Subject: [PATCH] meta title fix --- _plugins/seo_title_fix.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 _plugins/seo_title_fix.rb diff --git a/_plugins/seo_title_fix.rb b/_plugins/seo_title_fix.rb new file mode 100644 index 0000000..40582d8 --- /dev/null +++ b/_plugins/seo_title_fix.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Fix jekyll-seo-tag treating titles like "1. küldetés: ..." as Markdown +# ordered lists. The plugin's format_string method runs markdownify on +# every title, which turns "1. text" into "
  1. text
" and +# strip_html then loses the number entirely. +# +# This patch escapes a leading "N. " pattern before markdownify runs, +# so Markdown sees "1\. text" (literal) instead of a list item. + +module Jekyll + class SeoTag + class Drop < Jekyll::Drops::Drop + private + + alias_method :original_format_string, :format_string + + def format_string(string) + return unless string + + escaped = string.sub(/\A(\d+)\. /, '\1\. ') + + result = FORMAT_STRING_METHODS.reduce(escaped) do |memo, method| + filters.public_send(method, memo) + end + + result unless result.empty? + end + end + end +end