# Rebuild HTML for entire topic

**URL:** https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148
**Category:** Feature
**Created:** [June 8, 2017, 3:42am UTC](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148 "2017-06-08T03:42:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [June 8, 2017, 3:42am UTC](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148/1 "2017-06-08T03:42:46Z")

</div>

At the moment, Discourse provides staff the option to rebuild the HTML of a post. Could this be expanded to be done in an entire topic? We recently had to rebuild the HTML of a large topic, which was quite tedious as it takes 3 clicks per post to rebuild (hidden post options, post wrench, rebuild).

---

<div class="post-metadata">

### Author: ![hutchinsfairy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hutchinsfairy/32/103475_2.png) [@hutchinsfairy](https://meta.discourse.org/u/hutchinsfairy)
#### Post date: [June 8, 2017, 12:21pm UTC](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148/2 "2017-06-08T12:21:58Z")

</div>

I think this could be done via the console for all posts on a site:

> ./launcher enter app  
> rake posts:rebake

Best wait for a dev to confirm though.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [June 8, 2017, 12:34pm UTC](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148/3 "2017-06-08T12:34:05Z")

</div>

This will rebake all the posts of the forum. There’s _currently_ no way to specify a `topic_id`.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [June 8, 2017, 4:31pm UTC](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148/4 "2017-06-08T16:31:20Z")

</div>

> [@hutchinsfairy](#):
>
> I think this could be done via the console for all posts on a site:

Right - and as you said it requires console access, something that not all sites have. Happy to see @zogstrip say “currently”, hopefully this is something that could end up on a roadmap eventually 🙂.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [June 8, 2017, 7:42pm UTC](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148/5 "2017-06-08T19:42:56Z")

</div>

I believe the last time @techapj worked on this, he made it so the rebake goes in reverse chronological order, that is, it rebakes NEWEST posts first. That is usually what you want, because if you have a lot of topics, you want the stuff people are actually reading (aka the newer topics) to be corrected earlier.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [April 8, 2018, 7:21am UTC](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148/12 "2018-04-08T07:21:59Z")

</div>

> [@codinghorror](#):
>
> he made it so the rebake goes in reverse chronological order

I did this for a special friend of ours by manually patching the rake task on server with my _unoptimized_ hack. It got the work done but since the code was not optimized, I did not commit it to our source code.

~~I’ll add it on my list to come up with a good solution for this.~~ Done via:

[https://github.com/discourse/discourse/commit/adb93716ca7776d6f8bbf8f2680ede45fb267b4e](https://github.com/discourse/discourse/commit/adb93716ca7776d6f8bbf8f2680ede45fb267b4e)

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [April 8, 2018, 12:26pm UTC](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148/15 "2018-04-08T12:26:43Z")

</div>

I’ve split off a separate topic for this project as I’m moving into another direction as the original post:

> [@My journey into a massive posts rebake job](https://meta.discourse.org/t/my-journey-into-a-massive-posts-rebake-job/84816):
>
> I’m continuing this conversation from ‘[Rebuild HTML for entire topic](https://meta.discourse.org/t/rebuild-html-for-entire-topic/64148/14)’ as my experiments are going into quite another direction and I thought there might be value in sharing my thoughts and results as I go along. My situation is the following: we’re on the brink of launching a new migrated forum with over 4M posts. These will require a rebake when we switch to the final domain, and the posts need processing to make sure images are embedded correctly etc too. My concerns are: Rebaking is not a…
