learnlayout icon indicating copy to clipboard operation
learnlayout copied to clipboard

Page title is always "about this site"

Open sophiequ opened this issue 4 years ago • 4 comments

On learnlayout.com as well as when I clone and build the current repository, every site has the title <h1 class="content">about this site</h1> instead of, e.g. <h1 class="content">the box model</h1> see https://learnlayout.com/box-model.html. Unfortunately, I don't know enough about jekyll or if this might be a bug in some tool/library.

sophiequ avatar Dec 07 '20 11:12 sophiequ

Thank you for reporting this! I will take a look as soon as I'm able.

incompl avatar Dec 07 '20 16:12 incompl

@incompl any update on this issue?

HanzCEO avatar Jul 25 '21 03:07 HanzCEO

The latest code in the repo seams to compile into a correct version. The problem has obviously been solved. It might just need a re-deploy.

mkorbar avatar Sep 16 '21 11:09 mkorbar

This looks like it's still broken, when I build locally with jekyll 4.

It looks like the localization plugin is receiving a different key than expected. From what I can tell, jekyll is doing one pass of liquid transforms, then caching the results. When it renders the template again, the localization plugin sees a cached copy of page.title (about.title) and it looks up about.title.

I added these debug lines to _plugins/localize.rb's render method, and saw a lot of spots where the page title did not match what was getting fed into the plugin!

if @key == "about.title"
        puts "key is #{@key}, page.title is: #{context.registers[:page]["title"]}"
end

https://github.com/jekyll/jekyll/pull/7967 was the Jekyll bugfix that should have solved this kind of issue, but it looks like it clears template assigns, not template registers, which is the cache that's breaking things here. Lots of potential ways around it - the easiest is probably to just do a hacky fix that checks for .title literally, which will solve the immediate problem, though is wrong in general. The longer term fix might be upstream in jekyll (clear the cached registers) or to somehow recover the context in the plugin.

rrcobb avatar Mar 18 '22 19:03 rrcobb

I fixed this finally!

incompl avatar Nov 07 '22 18:11 incompl