Setting page title in a hook

Hi, I’m setting the page title in a pre_render hook. This used to work before upgrading to Jekyll 4.1.0, no longer works now. The reason appears to be that the property hashes where replaced by “drops”, and the title is no longer mutable. So I’m not sure if this is a bug or a feature, in case it’s the latter, how should I set the title in the hook?

Thanks

The master branch has reverted to using a mutable Hash.
You may point your Gemfile to the repository:

gem "jekyll", github: "jekyll/jekyll"

P.S. v4.1.1 will be out soon…

1 Like

Thanks, I did, but now I have the same issue with a document drop…

In case you haven’t figured it out already, title is simply a page / document’s data attribute which is mutable:

Jekyll::Hooks.register([:pages, :documents], :pre_render) do |doc|
  doc.data["title"] = custom_title
end
1 Like

This works, thank you!