Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdfd729b

Browse files
authored
Add metadata to tags page (StubbornJava#86)
1 parent7fdec6f commitdfd729b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

‎stubbornjava-webapp/src/main/java/com/stubbornjava/webapp/post/PostRoutes.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
importjava.util.List;
44

5+
importorg.jooq.lambda.Seq;
6+
57
importcom.stubbornjava.common.undertow.Exchange;
68
importcom.stubbornjava.webapp.PageRoutes;
79
importcom.stubbornjava.webapp.Response;
@@ -36,11 +38,18 @@ public static void recentPostsWithTag(HttpServerExchange exchange) {
3638
exchange.setStatusCode(StatusCodes.NOT_FOUND);
3739
}
3840

41+
StringmetaDesc ="View " +posts.size() +" " +tag +
42+
" examples and guides in Java" +
43+
Seq.seq(posts)
44+
.findFirst()
45+
.map(p ->" including " +p.getTitle() +".")
46+
.orElse(".");
3947
Responseresponse =Response.fromExchange(exchange)
4048
.with("posts",posts)
4149
.with("type","Tag")
4250
.with("value",tag)
4351
.with("noData",noData)
52+
.with("metaDesc",metaDesc)
4453
.withLibCounts()
4554
.withRecentPosts();
4655
Exchange.body().sendHtmlTemplate(exchange,"templates/src/pages/tagOrLibSearch",response);

‎stubbornjava-webapp/ui/src/pages/tagOrLibSearch.hbs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{#>templates/src/common/_base-layout}}
1+
{{#>templates/src/common/_base-layoutmetaDesc=metaDesc}}
22
{{#*inline"title"}}{{value}} Related Posts{{/inline}}
33
{{#*inline"content"}}
44
<divclass="container">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp