Fma965
(Fma965)
1
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/
Johani
(Joe)
2
Welcome to Meta @Fma965
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", {
@on("didInsertElement")
_changeExcerptLink() {
const excerptLink = this.element.querySelector(".topic-excerpt");
if (excerptLink) {
excerptLink.href = this.topic.lastReadUrl
}
}
});
</script>
Clicking the excerpt will then take the user to their last read post.
1 Like
Fma965
(Fma965)
3
Many thanks i have done a few other things via theme components and the PluginAPI but couldn’t figure this out
1 Like