mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Removed duplicate calls to moment()
- the return type of `getLastModifiedForDatum` is a moment object, and we're just wrapping it again in another moment call - moment is very heavy so we shouldn't do it unnecessarily - this makes boot time 1% quicker of heavy sites
This commit is contained in:
parent
f798955bc9
commit
b49210f4dd
1 changed files with 4 additions and 1 deletions
|
@ -95,6 +95,9 @@ class BaseSiteMapGenerator {
|
|||
this.lastModified = Date.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {moment.Moment}
|
||||
*/
|
||||
getLastModifiedForDatum(datum) {
|
||||
if (datum.updated_at || datum.published_at || datum.created_at) {
|
||||
const modifiedDate = datum.updated_at || datum.published_at || datum.created_at;
|
||||
|
@ -126,7 +129,7 @@ class BaseSiteMapGenerator {
|
|||
node = {
|
||||
url: [
|
||||
{loc: url},
|
||||
{lastmod: moment(this.getLastModifiedForDatum(datum)).toISOString()}
|
||||
{lastmod: this.getLastModifiedForDatum(datum).toISOString()}
|
||||
]
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue