Change Excerpt of topic to go to latest post instead of that specific message

I’m sure there is some super easy way to do this but i can’t figure it out.

This is my home page

If i click the title (red box) of the topic it takes me to where i last read up to on the post.

If i click the message (yellow box) of the topic it takes me to that specific post (which is the first post)

How can i override this/

Welcome to Meta @Fma965 :wave:

Add this to the common > header tab of a new theme component, then add that component to your theme.

<script type="text/discourse-plugin" version="0.8">
const { on } = require("discourse-common/utils/decorators");

api.modifyClass("component:topic-list-item", {
  _changeExcerptLink() {
    const excerptLink = this.element.querySelector(".topic-excerpt");
    if (excerptLink) {
       excerptLink.href = this.topic.lastReadUrl 

Clicking the excerpt will then take the user to their last read post.

1 Like

Many thanks :slight_smile: i have done a few other things via theme components and the PluginAPI but couldn’t figure this out

1 Like