Skip to content

Commit 1b75605

Browse files
elmorecNoahDragon
authored andcommitted
Support for "atom:icon" Element (#57)
1 parent 16398e5 commit 1b75605

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

atom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<feed xmlns="http://www.w3.org/2005/Atom">
33
<title>{{ config.title }}</title>
4+
{% if icon %}<icon>{{ icon }}</icon>{% endif %}
45
{% if config.subtitle %}<subtitle>{{ config.subtitle }}</subtitle>{% endif %}
56
<link href="{{ feed_url | uriencode }}" rel="self"/>
67
{% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %}

lib/generator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var nunjucks = require('nunjucks');
44
var env = new nunjucks.Environment();
55
var pathFn = require('path');
66
var fs = require('fs');
7+
var gravatar = require('hexo/lib/plugins/helper/gravatar');
78

89
env.addFilter('uriencode', function(str) {
910
return encodeURI(str);
@@ -33,9 +34,13 @@ module.exports = function(locals) {
3334
var url = config.url;
3435
if (url[url.length - 1] !== '/') url += '/';
3536

37+
var icon;
38+
if (config.email) icon = gravatar(config.email);
39+
3640
var xml = template.render({
3741
config: config,
3842
url: url,
43+
icon: icon,
3944
posts: posts,
4045
feed_url: config.root + feedConfig.path
4146
});

0 commit comments

Comments
 (0)