Skip to content

Commit

Permalink
Support for "atom:icon" Element (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
elmorec authored and NoahDragon committed Sep 6, 2017
1 parent 16398e5 commit 1b75605
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions atom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ config.title }}</title>
{% if icon %}<icon>{{ icon }}</icon>{% endif %}
{% if config.subtitle %}<subtitle>{{ config.subtitle }}</subtitle>{% endif %}
<link href="{{ feed_url | uriencode }}" rel="self"/>
{% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %}
Expand Down
5 changes: 5 additions & 0 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var nunjucks = require('nunjucks');
var env = new nunjucks.Environment();
var pathFn = require('path');
var fs = require('fs');
var gravatar = require('hexo/lib/plugins/helper/gravatar');

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

var icon;
if (config.email) icon = gravatar(config.email);

var xml = template.render({
config: config,
url: url,
icon: icon,
posts: posts,
feed_url: config.root + feedConfig.path
});
Expand Down

0 comments on commit 1b75605

Please sign in to comment.