{% if site.url %}

{% assign url_base = site.url | append: site.baseurl %}

{% else %}

{% assign url_base = site.github.url %}

{% endif %} <feed xmlns=“www.w3.org/2005/Atom”{% if site.lang %} xml:lang=“{{ site.lang }}”{% endif %}>

<generator uri="http://jekyllrb.com" version="{{ jekyll.version }}">Jekyll</generator>
<link href="{{ page.url | prepend: url_base }}" rel="self" type="application/atom+xml" />
<link href="{{ url_base }}/" rel="alternate" type="text/html" {% if site.lang %}hreflang="{{ site.lang }}" {% endif %}/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ url_base | xml_escape }}/</id>

{% if site.title %}
  <title>{{ site.title | xml_escape }}</title>
{% elsif site.name %}
  <title>{{ site.name | xml_escape }}</title>
{% endif %}

{% if site.description %}
  <subtitle>{{ site.description | xml_escape }}</subtitle>
{% endif %}

{% if site.author %}
  <author>
    {% if site.author.name %}
      <name>{{ site.author.name | xml_escape }}</name>
    {% else %}
      <name>{{ site.author | xml_escape }}</name>
    {% endif %}
    {% if site.author.email %}
      <email>{{ site.author.email | xml_escape }}</email>
    {% endif %}
    {% if site.author.uri %}
      <uri>{{ site.author.uri | xml_escape }}</uri>
    {% endif %}
  </author>
{% endif %}

{% for post in site.posts limit: 10 %}
{% unless post.draft %}
  <entry{% if post.lang %} xml:lang="{{ post.lang }}"{% endif %}>
    <title>{{ post.title | markdownify | strip_html | replace: '\n', ' ' | strip | xml_escape }}</title>
    <link href="{{ post.url | prepend: url_base }}" rel="alternate" type="text/html" title="{{ post.title | xml_escape }}" />
    <published>{{ post.date | date_to_xmlschema }}</published>
    {% if post.last_modified_at %}
      <updated>{{ post.last_modified_at | date_to_xmlschema }}</updated>
    {% else %}
      <updated>{{ post.date | date_to_xmlschema }}</updated>
    {% endif %}

    <id>{{ post.id | prepend: url_base | xml_escape }}</id>
    <content type="html" xml:base="{{ post.url | prepend: url_base | xml_escape }}">{{ post.content | strip | xml_escape }}</content>

    {% assign post_author = post.author | default: post.authors[0] | default: site.author %}
    {% assign post_author_email = false %}
    {% assign post_author_uri = false %}
    {% if post_author %}
      {% if post_author.email %}
        {% assign post_author_email = post_author.email %}
      {% else %}
        {% if site.data.authors and site.data.authors[post_author] %}
          {% assign post_author_email = site.data.authors[post_author].email %}
        {% endif %}
      {% endif %}
      {% if post_author.uri %}
        {% assign post_author_uri = post_author.uri %}
      {% else %}
        {% if site.data.authors and site.data.authors[post_author] %}
          {% assign post_author_email = site.data.authors[post_author].uri %}
        {% endif %}
      {% endif %}
      {% if post_author.name %}
        {% assign post_author = post_author.name %}
      {% endif %}
      <author>
          <name>{{ post_author | xml_escape }}</name>
        {% if post_author_email %}
          <email>{{ post_author_email | xml_escape }}</email>
        {% endif %}
        {% if post_author_uri %}
          <uri>{{ post_author_uri | xml_escape }}</uri>
        {% endif %}
      </author>
    {% endif %}

    {% if post.category %}
      <category term="{{ post.category | xml_escape }}" />
    {% endif %}

    {% for tag in post.tags %}
      <category term="{{ tag | xml_escape }}" />
    {% endfor %}

    {% if post.excerpt and post.excerpt != empty %}
      <summary>{{ post.excerpt | strip_html | replace: '\n', ' ' | strip | xml_escape }}</summary>
    {% endif %}

    {% assign post_image = post.image %}
    {% if post_image %}
      {% unless post_image contains "://" %}
        {% assign post_image = post_image | prepend: url_base | xml_escape  %}
      {% endunless %}
      <media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="{{ post_image }}" />
    {% endif %}
  </entry>
{% endunless %}
{% endfor %}

</feed>