Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
b7393818
Commit
b7393818
authored
Mar 10, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
⚡
Fix #12408
parent
2b08c209
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
src/main/java/org/b3log/solo/processor/SitemapProcessor.java
src/main/java/org/b3log/solo/processor/SitemapProcessor.java
+11
-15
No files found.
src/main/java/org/b3log/solo/processor/SitemapProcessor.java
View file @
b7393818
...
...
@@ -98,7 +98,7 @@ public class SitemapProcessor {
/**
* Returns the sitemap.
*
*
* @param context the specified context
*/
@RequestProcessing
(
value
=
"/sitemap.xml"
,
method
=
HTTPRequestMethod
.
GET
)
...
...
@@ -133,18 +133,17 @@ public class SitemapProcessor {
/**
* Adds articles into the specified sitemap.
*
*
* @param sitemap the specified sitemap
* @throws Exception exception
*/
private
void
addArticles
(
final
Sitemap
sitemap
)
throws
Exception
{
// XXX: query all articles?
final
Query
query
=
new
Query
().
setCurrentPageNum
(
1
).
setFilter
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
)).
addSort
(
Article
.
ARTICLE_CREATE_DATE
,
SortDirection
.
DESCENDING
);
// XXX: maybe out of memory
final
Query
query
=
new
Query
().
setCurrentPageNum
(
1
).
setFilter
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
)).
addSort
(
Article
.
ARTICLE_CREATE_DATE
,
SortDirection
.
DESCENDING
).
addProjection
(
Article
.
ARTICLE_PERMALINK
,
String
.
class
).
addProjection
(
Article
.
ARTICLE_UPDATE_DATE
,
Date
.
class
);
final
JSONObject
articleResult
=
articleRepository
.
get
(
query
);
final
JSONArray
articles
=
articleResult
.
getJSONArray
(
Keys
.
RESULTS
);
for
(
int
i
=
0
;
i
<
articles
.
length
();
i
++)
{
...
...
@@ -152,12 +151,9 @@ public class SitemapProcessor {
final
String
permalink
=
article
.
getString
(
Article
.
ARTICLE_PERMALINK
);
final
URL
url
=
new
URL
();
url
.
setLoc
(
Latkes
.
getServePath
()
+
permalink
);
final
Date
updateDate
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
final
String
lastMod
=
DateFormatUtils
.
ISO_DATETIME_TIME_ZONE_FORMAT
.
format
(
updateDate
);
url
.
setLastMod
(
lastMod
);
sitemap
.
addURL
(
url
);
...
...
@@ -166,9 +162,9 @@ public class SitemapProcessor {
/**
* Adds navigations into the specified sitemap.
*
*
* @param sitemap the specified sitemap
* @throws Exception exception
* @throws Exception exception
*/
private
void
addNavigations
(
final
Sitemap
sitemap
)
throws
Exception
{
final
JSONObject
result
=
pageRepository
.
get
(
new
Query
());
...
...
@@ -194,7 +190,7 @@ public class SitemapProcessor {
/**
* Adds tags (tag-articles) and tags wall (/tags.html) into the specified sitemap.
*
*
* @param sitemap the specified sitemap
* @throws Exception exception
*/
...
...
@@ -222,7 +218,7 @@ public class SitemapProcessor {
/**
* Adds archives (archive-articles) into the specified sitemap.
*
*
* @param sitemap the specified sitemap
* @throws Exception exception
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment