Skip to content

Commit

Permalink
🐛 静态博客页脚的相关阅读、随机阅读不显示文章列表 Fix #155
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jun 28, 2020
1 parent 9febf33 commit 5953341
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/b3log/solo/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ private static void routeIndexProcessors() {
articleGroup.post("/console/markdown/2html", articleProcessor::markdown2HTML).
get("/console/article-pwd", articleProcessor::showArticlePwdForm).
post("/console/article-pwd", articleProcessor::onArticlePwdForm).
get("/articles/random", articleProcessor::getRandomArticles).
get("/article/id/{id}/relevant/articles", articleProcessor::getRelevantArticles).
get("/articles/random.json", articleProcessor::getRandomArticles).
get("/article/relevant/{id}.json", articleProcessor::getRelevantArticles).
get("/get-article-content", articleProcessor::getArticleContent).
get("/articles", articleProcessor::getArticlesByPage).
get("/articles/tags/{tagTitle}", articleProcessor::getTagArticlesByPage).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.b3log.latke.ioc.Inject;
import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.util.CollectionUtils;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.*;
import org.b3log.solo.service.*;
Expand Down Expand Up @@ -112,7 +111,7 @@ public synchronized void genSite(final RequestContext context) {
genURI("/blog/info");
genURI("/manifest.json");
genURI("/rss.xml");
genURI("/articles/random");
genURI("/articles/random.json");

genArticles();
genTags();
Expand Down Expand Up @@ -260,6 +259,7 @@ private static void genArticles() throws Exception {
final String permalink = article.optString(Article.ARTICLE_PERMALINK);
try {
genArticle(permalink);
genURI("/article/relevant/" + article.optString(Keys.OBJECT_ID) + ".json");
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Generates an article [uri=" + permalink + "] failed", e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/js/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ $.extend(Page.prototype, {
var randomArticles1Label = this.tips.randomArticles1Label
// getRandomArticles
$.ajax({
url: Label.servePath + '/articles/random',
url: Label.servePath + '/articles/random.json',
type: 'GET',
success: function (result, textStatus) {
var randomArticles = result.randomArticles
Expand Down Expand Up @@ -295,7 +295,7 @@ $.extend(Page.prototype, {
*/
loadRelevantArticles: function (id, headTitle) {
$.ajax({
url: Label.servePath + '/article/id/' + id + '/relevant/articles',
url: Label.servePath + '/article/relevant/' + id + '.json',
type: 'GET',
success: function (data, textStatus) {
var articles = data.relevantArticles
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/js/page.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/main/resources/skins/metro-hot/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ window.MetroHot = {
loadRandomArticles: function() {
// getRandomArticles
$.ajax({
url: Label.servePath + "/articles/random",
url: Label.servePath + "/articles/random.json",
type: "GET",
success: function(result, textStatus) {
var randomArticles = result.randomArticles;
Expand Down Expand Up @@ -135,7 +135,7 @@ window.MetroHot = {
*/
loadRelevantArticles: function(id) {
$.ajax({
url: Label.servePath + "/article/id/" + id + "/relevant/articles",
url: Label.servePath + '/article/relevant/' + id + '.json',
type: "GET",
success: function(data, textStatus) {
var articles = data.relevantArticles;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/skins/metro-hot/js/common.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void getRelevantArticles() throws Exception {
final String articleId = article.optString(Keys.OBJECT_ID);

final MockRequest request = mockRequest();
request.setRequestURI("/article/id/" + articleId + "/relevant/articles");
request.setRequestURI("/article/relevant/" + articleId + ".json");
final MockResponse response = mockResponse();
mockDispatcher(request, response);

Expand Down

0 comments on commit 5953341

Please sign in to comment.