Newsletter excerpt

Hi devs,

Anyone had a look at only posting excerpts in the newsletter?

I’m having a go at it now as I figured it should be doable, but man, that is some convoluted code, caching and scheduling business going on…

All help and tips appreciated.

Thanks,
/Flemming

I’m wrapping up a solution for a client that uses the api to get the post content and then creates and schedules a newsletter from that.

Hi Cathy,

Hmm, that’s a bit more work than what I am looking for, but sounds like a good solution.

I was just hoping I could hard-code s.th “excerpt-ish” instead of “content-ish” in the sending process. - Just a quick fix until it gets added properly someday…

Well, continuing here, it seems all is located in @tryghost/email-service/lib/EmailRenderer.js => renderbody().

Thanks anyway,
/Flemming

Ad-hoc ninja-fix for self-hosted:

node_modules/@tryghost/email-service/lib/EmailRenderer.js:

async renderPostBaseHtml(post) {
  return post.get('custom_excerpt') || this.truncateHtml(post.get('plaintext'), 200, 105)
}

And in the template files,

node_modules/@tryghost/email-service/lib/email-templates/template.hbs
node_modules/@tryghost/email-service/lib/email-templates/template-old.hbs

…add some markup to click to continue reading after <!-- POST CONTENT END -->:

<tr class="post-content-row">
    <td class="{{classes.body}}">
        <!-- POST CONTENT START -->
        {{{html}}}
        <!-- POST CONTENT END -->

        {{#if paywall}}
            {{>paywall}}
        <!-- Added from here -->
        {{else}}
            <p><center><a href="{{post.url}}" class="view-online-link">Click to continue reading in browser</a></center></p>
        <!-- To here -->
        {{/if}}
    </td>
</tr>

-This of course will need to be redone for every version-update.