# Setting page title in a hook

**URL:** <https://talk.jekyllrb.com/t/setting-page-title-in-a-hook/4543>\
**Category:** Help\
**Created:** [June 7, 2020, 7:26am UTC](https://talk.jekyllrb.com/t/setting-page-title-in-a-hook/4543 "2020-06-07T07:26:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkamensky](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mkamensky/32/2578_2.png) [@mkamensky](https://talk.jekyllrb.com/u/mkamensky)\
**Post date:** [June 7, 2020, 7:26am UTC](https://talk.jekyllrb.com/t/setting-page-title-in-a-hook/4543/1 "2020-06-07T07:26:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [June 7, 2020, 7:29am UTC](https://talk.jekyllrb.com/t/setting-page-title-in-a-hook/4543/2 "2020-06-07T07:29:51Z")

</div>

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

```auto
gem "jekyll", github: "jekyll/jekyll"

```

P.S. _v4.1.1 will be out soon…_

---

<div class="post-metadata">

**Author:** ![mkamensky](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mkamensky/32/2578_2.png) [@mkamensky](https://talk.jekyllrb.com/u/mkamensky)\
**Post date:** [June 7, 2020, 7:39am UTC](https://talk.jekyllrb.com/t/setting-page-title-in-a-hook/4543/3 "2020-06-07T07:39:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)\
**Post date:** [June 7, 2020, 9:42am UTC](https://talk.jekyllrb.com/t/setting-page-title-in-a-hook/4543/4 "2020-06-07T09:42:39Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![mkamensky](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mkamensky/32/2578_2.png) [@mkamensky](https://talk.jekyllrb.com/u/mkamensky)\
**Post date:** [June 7, 2020, 10:10am UTC](https://talk.jekyllrb.com/t/setting-page-title-in-a-hook/4543/5 "2020-06-07T10:10:58Z")

</div>

This works, thank you!
