File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/main/java/com/stubbornjava/webapp/post Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .util .List ;
4
4
5
+ import org .jooq .lambda .Seq ;
6
+
5
7
import com .stubbornjava .common .undertow .Exchange ;
6
8
import com .stubbornjava .webapp .PageRoutes ;
7
9
import com .stubbornjava .webapp .Response ;
@@ -36,11 +38,18 @@ public static void recentPostsWithTag(HttpServerExchange exchange) {
36
38
exchange .setStatusCode (StatusCodes .NOT_FOUND );
37
39
}
38
40
41
+ String metaDesc = "View " + posts .size () + " " + tag +
42
+ " examples and guides in Java" +
43
+ Seq .seq (posts )
44
+ .findFirst ()
45
+ .map (p -> " including " + p .getTitle () + "." )
46
+ .orElse ("." );
39
47
Response response = Response .fromExchange (exchange )
40
48
.with ("posts" , posts )
41
49
.with ("type" , "Tag" )
42
50
.with ("value" , tag )
43
51
.with ("noData" , noData )
52
+ .with ("metaDesc" , metaDesc )
44
53
.withLibCounts ()
45
54
.withRecentPosts ();
46
55
Exchange .body ().sendHtmlTemplate (exchange , "templates/src/pages/tagOrLibSearch" , response );
Original file line number Diff line number Diff line change 1
- {{ #> templates/src/common/_base-layout }}
1
+ {{ #> templates/src/common/_base-layout metaDesc = metaDesc }}
2
2
{{ #*inline " title" }}{{ value }} Related Posts{{ /inline }}
3
3
{{ #*inline " content" }}
4
4
<div class =" container" >
You can’t perform that action at this time.
0 commit comments