Skip to content

Commit

Permalink
Merge pull request #59 from ItzNotABug/add-subtiles-to-newsletters
Browse files Browse the repository at this point in the history
Add Excerpt to Newsletters
  • Loading branch information
ItzNotABug authored Jun 16, 2024
2 parents 6251848 + 7e6f0b4 commit e8b8766
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions configuration/config.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"newsletter": {
"center_title": false,
"show_excerpt": false,
"footer_content": "",
"show_comments": true,
"show_feedback": true,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "ghosler",
"description": "Send newsletter emails to your members, using your own email credentials!",
"version": "0.97",
"private": true,
"version": "0.98",
"main": "app.js",
"type": "module",
"author": "@itznotabug",
Expand Down
3 changes: 3 additions & 0 deletions utils/data/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export default class ProjectConfigs {
const ghostAdminSecret = formData['ghost.secret'];
const newsletterTrackLinks = formData['newsletter.track_links'];
const newsletterCenterTitle = formData['newsletter.center_title'];
const newsletterShowExcerpt = formData['newsletter.show_excerpt'];
const newsletterShowFeedback = formData['newsletter.show_feedback'];
const newsletterShowComments = formData['newsletter.show_comments'];
const newsletterShowLatestPosts =
Expand Down Expand Up @@ -248,6 +249,8 @@ export default class ProjectConfigs {
configs.newsletter.track_links = newsletterTrackLinks === 'on' ?? true;
configs.newsletter.center_title =
newsletterCenterTitle === 'on' ?? false;
configs.newsletter.show_excerpt =
newsletterShowExcerpt === 'on' ?? false;
configs.newsletter.show_feedback =
newsletterShowFeedback === 'on' ?? true;
configs.newsletter.show_comments =
Expand Down
4 changes: 3 additions & 1 deletion utils/newsletter.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default class Newsletter {

const customisations = await ProjectConfigs.newsletter();
postData.center_title = customisations.center_title;
postData.show_excerpt = customisations.show_excerpt;
postData.show_feedback = customisations.show_feedback;
postData.show_subscription = customisations.show_subscription;
postData.show_featured_image = customisations.show_featured_image;
Expand Down Expand Up @@ -311,7 +312,7 @@ export default class Newsletter {
title: 'Welcome',
author: 'Ghost',
preview:
"We've crammed the most important information to help you get started with Ghost into this one post. It's your cheat-sheet to get started, and your shortcut to advanced features.",
'The most important info. to get you started with Ghost.',
content:
"<div><p><strong>Hey there</strong>, welcome to your new home on the web!</p><hr><h3>Ghost</h3><p>Ghost is an independent, open source app, which means you can customize absolutely everything. Inside the admin area, you'll find straightforward controls for changing themes, colors, navigation, logos and settings — so you can set your site up just how you like it. No technical knowledge required.</p><hr><h3>Ghosler</h3><p>Ghosler is an open source project designed for those starting with Ghost or managing a small to moderate user base. It provides extensive control over newsletter settings and customization, enhancing your outreach with features like URL Click Tracking, Newsletter Feedback, Email Deliverability, and Email Open Rate Analytics. Additionally, Ghosler handles both Free & Paid members content management efficiently.</p><p>Moreover, Ghosler supports popular Ghost widgets, including Images/Unsplash, Audio, Video, File, Toggle, Callout Card, and social media integrations like Twitter (X), YouTube, Vimeo, along with Button, Bookmark, and Blockquote features.</p><hr><h3>Ending the Preview</h3><p>Once you're ready to begin publishing and want to clear out these starter posts, you can delete the Ghost staff user. Deleting an author will automatically remove all of their posts, leaving you with a clean blank canvas.</p></div>",
comments: 'https://bulletin.ghost.io/welcome/#ghost-comments',
Expand All @@ -334,6 +335,7 @@ export default class Newsletter {

const customisations = await ProjectConfigs.newsletter();
preview.center_title = customisations.center_title;
preview.show_excerpt = customisations.show_excerpt;
preview.show_feedback = customisations.show_feedback;
preview.show_comments = customisations.show_comments;
preview.show_subscription = customisations.show_subscription;
Expand Down
17 changes: 17 additions & 0 deletions views/newsletter.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@
line-height: 1.15em !important;
}
table.body .post-excerpt {
font-size: 16px !important;
}
table.body .post-meta.view-online-mobile {
display: table-row !important;
}
Expand Down Expand Up @@ -926,6 +930,19 @@
</td>
</tr>

<!-- Post Excerpt If Enabled -->
<% if (show_excerpt && post.preview) { %>
<tr>
<td class="post-excerpt"
align="<% if (center_title) { %>center<% } else { %>left<% } %>"
style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 18px; vertical-align: top; color: #15212A; width: 100%; max-width: 600px; text-align: <% if (center_title) { %>center<% } else { %>left<% } %>;"
valign="top" width="100%">
<p class="post-excerpt"
style="margin: 0; padding-bottom: 20px; color: #15212A; line-height: 1.6em; font-size: 18px; font-family: Georgia, serif; text-align: <% if (center_title) { %>center<% } else { %>left<% } %>;"><%= post.preview %> </p>
</td>
</tr>
<% } %>

<!-- Post Meta -->
<tr>
<td style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 18px; vertical-align: top; color: #15212A; width: 100%;"
Expand Down
10 changes: 10 additions & 0 deletions views/partials/settings/customise.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
<label for="newsletter.center_title" class="text-gray-300">Center Title</label>
</div>

<!-- Show Excerpt Checkbox -->
<div class="form-group mb-4 flex items-center">
<input type="checkbox" class="form-checkbox h-4 w-4 text-blue-600 rounded border-gray-600 mr-2"
id="newsletter.show_excerpt" name="newsletter.show_excerpt"
<% if (Boolean(configs.newsletter.show_excerpt ?? false)) { %> checked
<% } %>
>
<label for="newsletter.show_excerpt" class="text-gray-300">Show Excerpt</label>
</div>

<!-- Track URL Clicks Checkbox -->
<div class="form-group mb-4">
<div class="flex items-center">
Expand Down

0 comments on commit e8b8766

Please sign in to comment.