Skip to content

Commit

Permalink
Merge branch 'main' into refactor/4016
Browse files Browse the repository at this point in the history
  • Loading branch information
guqing authored Jun 5, 2023
2 parents 39f6de3 + a56d4f2 commit 0f3180f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ docker run \
--name halo \
-p 8090:8090 \
-v ~/.halo2:/root/.halo2 \
halohub/halo:2.5 \
halohub/halo:2.6 \
--halo.security.initializer.superadminusername=admin \
--halo.security.initializer.superadminpassword=P@88w0rd
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.util.HtmlUtils;
import org.thymeleaf.context.ITemplateContext;
import org.thymeleaf.model.IModel;
import org.thymeleaf.model.IModelFactory;
Expand Down Expand Up @@ -70,18 +71,19 @@ public Mono<Void> process(ITemplateContext context, IModel model,
static List<Map<String, String>> excerptToMetaDescriptionIfAbsent(
List<Map<String, String>> htmlMetas,
String excerpt) {
final String excerptNullSafe = StringUtils.defaultString(excerpt);
String excerptNullSafe = StringUtils.defaultString(excerpt);
final String excerptSafe = HtmlUtils.htmlEscape(excerptNullSafe);
List<Map<String, String>> metas = new ArrayList<>(defaultIfNull(htmlMetas, List.of()));
metas.stream()
.filter(map -> Meta.DESCRIPTION.equals(map.get(Meta.NAME)))
.distinct()
.findFirst()
.ifPresentOrElse(map ->
map.put(Meta.CONTENT, defaultIfBlank(map.get(Meta.CONTENT), excerptNullSafe)),
map.put(Meta.CONTENT, defaultIfBlank(map.get(Meta.CONTENT), excerptSafe)),
() -> {
Map<String, String> map = new HashMap<>();
map.put(Meta.NAME, Meta.DESCRIPTION);
map.put(Meta.CONTENT, excerptNullSafe);
map.put(Meta.CONTENT, excerptSafe);
metas.add(map);
});
return metas;
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=2.6.0-SNAPSHOT
version=2.7.0-SNAPSHOT
r2dbc-mysql.version=1.0.2

0 comments on commit 0f3180f

Please sign in to comment.