diff --git a/pom.xml b/pom.xml index 0527d215..52a21bee 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 3.15.1 1.0.24 1.7.2-alpha - 0.1.5 + 0.1.6-alpha 0.0.9 0.1.3 diff --git a/src/main/java/com/tale/controller/IndexController.java b/src/main/java/com/tale/controller/IndexController.java index c90d69d0..d0e98ce0 100644 --- a/src/main/java/com/tale/controller/IndexController.java +++ b/src/main/java/com/tale/controller/IndexController.java @@ -222,6 +222,12 @@ public String search(Request request, @PathParam String keyword, @QueryParam(val return this.search(request, keyword, 1, limit); } + @Route(values = {"search", "search.html"}) + public String search(Request request, @QueryParam(value = "limit", defaultValue = "12") int limit) { + String keyword = request.query("s"); + return this.search(request, keyword, 1, limit); + } + @Route(values = {"search/:keyword/:page", "search/:keyword/:page.html"}, method = HttpMethod.GET) public String search(Request request, @PathParam String keyword, @PathParam int page, @QueryParam(value = "limit", defaultValue = "12") int limit) { diff --git a/src/main/java/com/tale/ext/Theme.java b/src/main/java/com/tale/ext/Theme.java index 028bf787..671d9e0e 100644 --- a/src/main/java/com/tale/ext/Theme.java +++ b/src/main/java/com/tale/ext/Theme.java @@ -570,4 +570,17 @@ public static String comments_num(String noComment, String value){ public static String theme_option(String key){ return TaleConst.OPTIONS.get("theme_option_" + key); } + + /** + * 返回是否是某个页面 + * @param pageName + * @return + */ + public static boolean is_slug(String pageName){ + Contents contents = current_article(); + if(null != contents && Types.PAGE.equals(contents.getType()) && contents.getSlug().equals(pageName)){ + return true; + } + return false; + } }