# Excerpts truncating at 50 characters

**URL:** https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993
**Category:** Support
**Created:** [September 9, 2019, 3:48am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993 "2019-09-09T03:48:16Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![louquillio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louquillio/32/117675_2.png) [@louquillio](https://meta.discourse.org/u/louquillio)
#### Post date: [September 9, 2019, 3:48am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/1 "2019-09-09T03:48:16Z")

</div>

I had topic excerpts working as desired — that is, they observed `post_excerpt_maxlength` in all cases. I first did this with [a plugin](https://github.com/hnb-ku/discourse-topic-excerpt-plugin) (which worked), then learned about `SiteSetting.always_include_topic_excerpts = true`, so switched to that. Still worked.

About two days ago, perhaps after applying 2.4.0.beta4, excerpts started truncating at 50 characters. Very mysterious.

I’ve tried flipping `SiteSetting.always_include_topic_excerpts` and reinstalling the plugin, and changing the value of `post_excerpt_maxlength`, but no change. Still stuck at 50 characters.

Anybody else seeing this? Dunno what else to try.

---

<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: [September 9, 2019, 4:41am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/2 "2019-09-09T04:41:45Z")

</div>

Could this be a bug @neil?

---

<div class="post-metadata">

### Author: ![louquillio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louquillio/32/117675_2.png) [@louquillio](https://meta.discourse.org/u/louquillio)
#### Post date: [September 9, 2019, 5:23am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/3 "2019-09-09T05:23:35Z")

</div>

Another point is that it’s affecting only new topics. Older topics with longer excerpts still have them.

Adding a post to such a topic _doesn’t_ shorten the excerpt (unsurprising), but editing the first post _does_ cause the excerpt to newly truncate at 50 chars.

So while I haven’t looked (Discourse noob), it seems that excerpts are a database field, and the truncation only happens on a record update.

LQ

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [September 9, 2019, 2:06pm UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/4 "2019-09-09T14:06:55Z")

</div>

The plugin you linked to has hard-coded 50:

[https://github.com/hnb-ku/discourse-topic-excerpt-plugin/blob/master/plugin.rb#L8](https://github.com/hnb-ku/discourse-topic-excerpt-plugin/blob/master/plugin.rb#L8)

You can fork the plugin and put `SiteSetting.post_excerpt_maxlength` instead of 50, or @Johani can update it for you.

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [September 9, 2019, 2:16pm UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/5 "2019-09-09T14:16:35Z")

</div>

That plugin hasn’t been updated for almost two years now and it predates the addition of the `always_include_topic_excerpts` setting. You should not be using it at all. I’ve added a deprecation notice and will delete that repository in a week or so.

Please remove that outdated plugin, enable the `always_include_topic_excerpts` setting and report back if you still have the same problem.

---

<div class="post-metadata">

### Author: ![louquillio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louquillio/32/117675_2.png) [@louquillio](https://meta.discourse.org/u/louquillio)
#### Post date: [September 9, 2019, 2:47pm UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/6 "2019-09-09T14:47:11Z")

</div>

> [@Johani](#):
>
> Please remove that outdated plugin, enable the `always_include_topic_excerpts` setting and report back if you still have the same problem.

This seems to work. I had been thrown off because applying the plugin got me the (300 char) excerpts I wanted, where before I had none. I suppose that only subsequently-created topics exhibited the hard-coded `50`.

One wrinkle: Existing topics with 50 char excerpts still have them. It seems necessary to touch the OP of these topics to lengthen their excerpts to `post_excerpt_maxlength`. Any way to automate that? Thanks.

LQ

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [September 9, 2019, 11:22pm UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/7 "2019-09-09T23:22:01Z")

</div>

You’ll need to rebake the posts in order for the them to follow the new limit. More on that [here.](https://meta.discourse.org/t/rebake-all-posts/69340/2)

---

<div class="post-metadata">

### Author: ![louquillio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louquillio/32/117675_2.png) [@louquillio](https://meta.discourse.org/u/louquillio)
#### Post date: [September 10, 2019, 12:29am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/8 "2019-09-10T00:29:09Z")

</div>

Are these truly interchangeable today?

```plaintext
rake posts:rebake

bundle exec rake posts:rebake

```

Because the first rake task completed without issue but didn’t regenerate the excerpts. Nevertheless, site was running.

Then tried with `be`. This exited with:

```plaintext
rake aborted!
PG::ConnectionBad: FATAL: Peer authentication failed for user "discourse"

```

… followed by a stack trace. Now, topic pages are unreachable. Home page is reachable, and most of admin is reachable — though charts on admin home fail to load. Running …

```plaintext
rake posts:rebake

```

… doesn’t fix things. Eventually rebooted the droplet, but the condition persists. Any help appreciated.

LQ

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [September 10, 2019, 12:42am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/9 "2019-09-10T00:42:44Z")

</div>

> [@louquillio](#):
>
> Are these truly interchangeable today?

Yes, I just tried both

```bash
$ cd /var/discourse
$ ./launcher enter app
$ bundle exec rake posts:rebake

Rebaking post markdown for 'default'
      297 / 297 (100.0%)
297 posts done!
--------------------------------------------------
$ cd /var/discourse
$ ./launcher enter app
$ rake posts:rebake

Rebaking post markdown for 'default'
      297 / 297 (100.0%)
297 posts done!

```

and they worked without issue.

> [@louquillio](#):
>
> ```plaintext
> rake aborted!
> PG::ConnectionBad: FATAL: Peer authentication failed for user "discourse"
> 
> ```

This implies that you have other problems. Did you follow the [supported installation guide](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) when you set your site up?

---

<div class="post-metadata">

### Author: ![louquillio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louquillio/32/117675_2.png) [@louquillio](https://meta.discourse.org/u/louquillio)
#### Post date: [September 10, 2019, 12:44am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/10 "2019-09-10T00:44:58Z")

</div>

> [@Johani](#):
>
> This implies that you have other problems. Did you follow the [supported installation guide](https://github.com/discourse/discourse/blob/master/docs/INSTALL.md) when you set your site up?

Yes. Installed exactly as stated in `INSTALL-cloud.md`

Only difference is that it’s 19.04. Haven’t updated any gems manually or anything like that.

Here’s the full output of `bundle exec rake posts:rebake --trace`

> <https://pastebin.com/giBxkCJt>

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [September 10, 2019, 12:59am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/11 "2019-09-10T00:59:58Z")

</div>

I can’t say for sure, but I think you might have two separate problems.

Try the following to narrow this down a bit more.

- remove any non-official plugins
- rebuild the app
- try [safe-mode](https://meta.discourse.org/t/how-to-use-discourse-safe-mode/53504) and see if the app loads

Are you seeing any errors in your browser console on the broken pages?

---

<div class="post-metadata">

### Author: ![louquillio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louquillio/32/117675_2.png) [@louquillio](https://meta.discourse.org/u/louquillio)
#### Post date: [September 10, 2019, 1:15am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/12 "2019-09-10T01:15:55Z")

</div>

Removed footnotes and checkbox plugins. Not sure if those are official. Rebuilt. No console errors on non-[safe mode](https://meta.discourse.org/t/53504?silent=true) load. Site is up.

Any benefit to testing [safe mode](https://meta.discourse.org/t/53504?silent=true) for console errors? If not, would appear to be one of those plugins.

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [September 10, 2019, 1:38am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/13 "2019-09-10T01:38:12Z")

</div>

> [@louquillio](#):
>
> Not sure if those are official

Yes, those are official, but be sure that you’re not using a fork of some sort. Official plugins have a checkmark next to their names in the admin

 ![pluginPage01](https://global.discourse-cdn.com/meta/original/3X/f/b/fbfa85f19aae34a5f2d7fd9586d843daac895655.png)

and are hosted under `https://github.com/discourse/`

I just tried both on the latest and I’m not able to reproduce the issue you’re having - the site not loading.

> [@louquillio](#):
>
> Any benefit to testing [safe mode](https://meta.discourse.org/t/53504?silent=true) for console errors?

If there’s no errors in the normal, non-[safe mode](https://meta.discourse.org/t/53504?silent=true), then you don’t need to check that in safe-mode.

I’m guessing the excerpts have still not been updated?

Have you checked `your.site.com/logs` ?

---

<div class="post-metadata">

### Author: ![louquillio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/louquillio/32/117675_2.png) [@louquillio](https://meta.discourse.org/u/louquillio)
#### Post date: [September 10, 2019, 1:46am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/14 "2019-09-10T01:46:46Z")

</div>

> [@Johani](#):
>
> I’m guessing the excerpts have still not been updated?

No, but it’s a young instance. I’m gonna let it go.

> [@Johani](#):
>
> Have you checked `your.site.com/logs` ?

Yeah, nothing exciting. I do `unattended-upgrades` and it looks like dpkg was maybe running at rebake time. Not gonna sweat it.

Appreciate the help.

LQ

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 10, 2019, 1:46am UTC](https://meta.discourse.org/t/excerpts-truncating-at-50-characters/127993/15 "2019-10-10T01:46:52Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
