mirror of https://gitlab.com/curben/blog
				
				
				
			fix(feed): published data should be formatted correctly
- rename 'data' function to 'formatDate' for clarity
This commit is contained in:
		
							parent
							
								
									88a26ab144
								
							
						
					
					
						commit
						c0c8c846d1
					
				|  | @ -6,7 +6,7 @@ | |||
|   <link href="{{ feed_url | uriencode }}" rel="self"/> | ||||
|   {% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %} | ||||
|   <link href="{{ url | uriencode }}"/> | ||||
|   <updated>{% if posts.first().updated %}{{ posts.first().updated | date }}{% else %}{{ posts.first().date | date }}{% endif %}</updated> | ||||
|   <updated>{% if posts.first().updated %}{{ posts.first().updated | formatDate }}{% else %}{{ posts.first().date | formatDate }}{% endif %}</updated> | ||||
|   <id>{{ url | uriencode }}</id> | ||||
|   {% if config.author %} | ||||
|   <author> | ||||
|  | @ -20,8 +20,8 @@ | |||
|     <title>{{ post.title }}</title> | ||||
|     <link href="{{ post.permalink }}"/> | ||||
|     <id>{{ post.permalink }}</id> | ||||
|     <published>{{ post.date.toISOString() }}</published> | ||||
|     <updated>{% if post.updated %}{{ post.updated | date }}{% else %}{{ post.date | date }}{% endif %}</updated> | ||||
|     <published>{{ post.date | formatDate }}</published> | ||||
|     <updated>{% if post.updated %}{{ post.updated | formatDate }}{% else %}{{ post.date | formatDate }}{% endif %}</updated> | ||||
|     {% if config.feed.content and post.content %} | ||||
|     <content type="html"><![CDATA[{{ post.content | noControlChars | safe }}]]></content> | ||||
|     {% endif %} | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ env.addFilter('noControlChars', str => { | |||
|   return str.replace(/[\x00-\x1F\x7F]/g, '') // eslint-disable-line no-control-regex
 | ||||
| }) | ||||
| 
 | ||||
| env.addFilter('date', str => { | ||||
| env.addFilter('formatDate', str => { | ||||
|   return moment(str).format('YYYY-MM-DD[T00:00:00.000Z]') | ||||
| }) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue