Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add summary image field and improve UI #24

Merged
merged 6 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions dub.selections.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
"antispam": "0.1.7",
"diet-ng": "1.8.2",
"diskuto": "1.7.6",
"eventcore": "0.9.33",
"eventcore": "0.9.35",
"fuzzydate": "1.0.0",
"mir-linux-kernel": "1.0.1",
"openssl": "3.3.3",
"mir-linux-kernel": "1.2.1",
"openssl": "3.3.4",
"openssl-static": "1.0.5+3.0.8",
"stdx-allocator": "2.77.5",
"stringex": "0.1.1",
"taggedalgebraic": "0.11.23",
"vibe-container": "1.3.1",
"vibe-core": "2.9.1",
"vibe-core": "2.9.6",
"vibe-d": "0.10.1",
"vibe-http": "1.1.1",
"vibe-inet": "1.0.0",
"vibe-serialization": "1.0.5",
"vibe-stream": "1.1.0"
"vibe-http": "1.1.2",
"vibe-inet": "1.0.1",
"vibe-serialization": "1.0.6",
"vibe-stream": "1.1.1"
}
}
5 changes: 4 additions & 1 deletion source/vibelog/post.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ final class Post {
SysTime date;
string header; // Title/heading
string headerImage; // URL of large header image
string summaryImage; // Image to use for the summary (fall back to headerImage)
string summaryTitle; // Short title used for the summary (<=70chars)
string summary; // Short summary of the article (<=240 chars), displayed on cards
string subHeader; // First paragraph of the articule, displayed on overview pages
string subHeader; // First paragraph of the article, displayed on overview pages
string content;
string[] filters;
string[] tags;
Expand Down Expand Up @@ -54,6 +55,7 @@ final class Post {
ret.header = cast(string)bson["header"];
ret.subHeader = cast(string)bson["subHeader"];
ret.content = cast(string)bson["content"];
ret.summaryImage = bson["summaryImage"].opt!string;
ret.summary = bson["summary"].opt!string;
ret.summaryTitle = bson["summaryTitle"].opt!string;

Expand Down Expand Up @@ -85,6 +87,7 @@ final class Post {
ret["header"] = Bson(header);
ret["subHeader"] = Bson(subHeader);
ret["content"] = Bson(content);
ret["summaryImage"] = Bson(summaryImage);
ret["summary"] = Bson(summary);
ret["summaryTitle"] = Bson(summaryTitle);

Expand Down
4 changes: 2 additions & 2 deletions source/vibelog/settings.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import vibe.db.mongo.connection;
import vibe.textfilter.markdown;

final class VibeLogSettings {
string databaseURL = "mongodb://localhost/vibelog";
string databaseURL = "mongodb://127.0.0.1/vibelog";
string configName = "global";
string blogName = "VibeLog";
string blogDescription = "Publishing software utilizing the vibe.d framework";
string blogDescription = "Web publishing based on the vibe.d framework";
int postsPerPage = 4;
int maxRecentPosts = 20;
bool showFullPostsInPostList = true;
Expand Down
8 changes: 5 additions & 3 deletions source/vibelog/webadmin.d
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ void registerVibeLogWebAdmin(URLRouter router, VibeLogController controller)
@auth @errorDisplay!getMakePost
void postMakePost(bool isPublic, bool commentsAllowed, string author,
string date, string category, string slug, string headerImage, string header, string subHeader,
string summary, string summaryTitle, string content, string filters, AuthInfo _auth)
string summaryImage, string summary, string summaryTitle, string content, string filters, AuthInfo _auth)
{
postPutPost(null, isPublic, commentsAllowed, author, date, category, slug, headerImage,
header, subHeader, summary, summaryTitle, content, filters, null, _auth);
header, subHeader, summaryImage, summary, summaryTitle, content, filters, null, _auth);
}

@path("posts/:postname/")
Expand All @@ -286,7 +286,8 @@ void registerVibeLogWebAdmin(URLRouter router, VibeLogController controller)
@path("posts/:postname/") @errorDisplay!getEditPost
void postPutPost(string id, bool isPublic, bool commentsAllowed, string author,
string date, string category, string slug, string headerImage, string header, string subHeader,
string summary, string summaryTitle, string content, string filters, string _postname, AuthInfo _auth)
string summaryImage, string summary, string summaryTitle, string content,
string filters, string _postname, AuthInfo _auth)
{
import vibe.data.bson : BsonObjectID;

Expand All @@ -310,6 +311,7 @@ void registerVibeLogWebAdmin(URLRouter router, VibeLogController controller)
p.headerImage = headerImage;
p.header = header;
p.subHeader = subHeader;
p.summaryImage = summaryImage;
p.summary = summary;
p.summaryTitle = summaryTitle;
p.content = content;
Expand Down
14 changes: 12 additions & 2 deletions views/vibelog.admin.editpost.dt
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ block vibelog-content
hr
tr
td
label(for="header-field") Heading
label(for="summaryImage-field") Summary image
td
input#header-field(type="text", name="header", value="#{info.post ? info.post.header : null}")
input#summaryImage-field(type="text", name="summaryImage", value="#{info.post ? info.post.summaryImage : null}")
tr
td
label(for="summary-title-field") Summary title
Expand All @@ -98,6 +98,16 @@ block vibelog-content
label(for="summary-field") Summary
td
input#summary-field(type="text", name="summary", value="#{info.post ? info.post.summary : null}", maxlength=240)
tr
td(colspan=2) Note: Summary fields are used to generate the meta tags used for link previews
tr
td(colspan=2)
hr
tr
td
label(for="header-field") Heading
td
input#header-field(type="text", name="header", value="#{info.post ? info.post.header : null}")
tr
td
label(for="subHeader") Sub-Heading
Expand Down
9 changes: 9 additions & 0 deletions views/vibelog.post.dt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ extends vibelog.blocks
block vibelog.title
- title = info.post.header;

block vibelog.layout.head
meta(property="og:type", content="article")
meta(property="og:title", content=info.post.summaryTitle.length ? info.post.summaryTitle : info.post.header)
- if (info.post.summary.length)
meta(property="og:description", content=info.post.summary)
meta(property="og:image", content=info.post.summaryImage.length ? info.post.summaryImage : info.post.headerImage)
meta(property="twitter:card", content="summary_large_image")
meta(property="twitter:site", content="@bildhuus")

block vibelog-content
- import std.datetime;
- import vibe.inet.message;
Expand Down
Loading