mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
Merge pull request #4848 from chilts/i4792-assign-higher-priority-in-sitemaps-to-featured-posts
Assign a higher priority to featured posts in the sitemap
This commit is contained in:
commit
9668ed71ca
2 changed files with 15 additions and 5 deletions
|
@ -36,9 +36,9 @@ _.extend(PostMapGenerator.prototype, {
|
|||
return config.urlFor('post', {post: post, permalinks: permalinks}, true);
|
||||
},
|
||||
|
||||
getPriorityForDatum: function () {
|
||||
// TODO: We could influence this with meta information
|
||||
return 0.8;
|
||||
getPriorityForDatum: function (post) {
|
||||
// give a slightly higher priority to featured posts
|
||||
return post.featured ? 0.9 : 0.8;
|
||||
},
|
||||
|
||||
createUrlNodeFromDatum: function (datum) {
|
||||
|
|
|
@ -415,10 +415,20 @@ describe('Sitemap', function () {
|
|||
});
|
||||
|
||||
describe('PostGenerator', function () {
|
||||
it('uses 0.8 priority for all posts', function () {
|
||||
it('uses 0.9 priority for featured posts', function () {
|
||||
var generator = new PostGenerator();
|
||||
|
||||
generator.getPriorityForDatum({}).should.equal(0.8);
|
||||
generator.getPriorityForDatum({
|
||||
featured: true
|
||||
}).should.equal(0.9);
|
||||
});
|
||||
|
||||
it('uses 0.8 priority for all other (non-featured) posts', function () {
|
||||
var generator = new PostGenerator();
|
||||
|
||||
generator.getPriorityForDatum({
|
||||
featured: false
|
||||
}).should.equal(0.8);
|
||||
});
|
||||
|
||||
it('adds an image:image element if post has a cover image', function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue