Created
January 21, 2019 22:03
-
-
Save jooray/268c7a156bab2575606fc7f15375d287 to your computer and use it in GitHub Desktop.
Export jekyll as RSS, remove newlines in the full text to allow importing in wordpress. Put into pages/export.xml and regenerate your jekyll site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: null | |
--- | |
{%- capture newline %} | |
{% endcapture -%} | |
<?xml version="1.0" encoding="UTF-8"?> | |
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> | |
<channel> | |
<title>{{ site.title | xml_escape }}</title> | |
<description>{{ site.description | xml_escape }}</description> | |
<link>{{ site.url }}{{ site.baseurl }}/</link> | |
<atom:link href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml"/> | |
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate> | |
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate> | |
<generator>Jekyll v{{ jekyll.version }}</generator> | |
{% for post in site.posts limit:100 %} | |
<item> | |
<title>{{ post.title | xml_escape }}</title> | |
<excerpt> | |
{% if post.video %} | |
<iframe width="1280" height="720" src="{% if post.video contains 'youtu' %}https://www.youtube.com/embed/{{ post.video | remove: "https://www.youtube.com/watch?v=" | remove: "https://youtu.be/" | xml_escape }}{% elsif post.video contains 'vimeo.com' %}https://player.vimeo.com/video/{{ post.video | remove: "https://vimeo.com/" | xml_escape }}{% else %}{{ post.video | xml_escape }}{% endif %}{{ post.embed | xml_escape }}" frameborder="0" allowfullscreen></iframe> | |
{% endif %} | |
{{ post.excerpt | xml_escape }}</excerpt> | |
<description> | |
{% if post.video %} | |
<iframe width="1280" height="720" src="{% if post.video contains 'youtu' %}https://www.youtube.com/embed/{{ post.video | remove: "https://www.youtube.com/watch?v=" | remove: "https://youtu.be/" | xml_escape }}{% elsif post.video contains 'vimeo.com' %}https://player.vimeo.com/video/{{ post.video | remove: "https://vimeo.com/" | xml_escape }}{% else %}{{ post.video | xml_escape }}{% endif %}{{ post.embed | xml_escape }}" frameborder="0" allowfullscreen></iframe> | |
{% endif %} | |
{% if post.podcast_link %} | |
<p> <audio controls> <source src="{{ post.podcast_link }}" type="audio/mpeg"/> </audio><br/> <a href="{{ post.podcast_link }}" download>Download audio</a> </p> | |
{% endif %} | |
{% if post.video or post.embed %} | |
{% elsif post.image %} | |
<figure> <a href="{{ post.url | absolute_url | xml_escape }}" title="{{ post.title | escape_once | xml_escape }}"><img src="{{ "/images/" | absolute_url }}{{ post.image | xml_escape }}" alt="{{ post.title | escape_once | xml_escape }}"></a> {% if post.caption_url and post.caption %} <figcaption> <a href="{{ post.caption_url | xml_escape }}">{{ post.caption | xml_escape }}</a> </figcaption> {% elsif post.caption %} <figcaption> {{ post.caption |xml_escape }} </figcaption> {% endif %} </figure> | |
{% endif %} | |
{{ post.content | replace: newline, ' ' | xml_escape }}</description> | |
<pubDate>{{ post.date | date_to_rfc822 | replace: '00:00:00', '08:00:00' }}</pubDate> | |
<link>{{ post.url | prepend: site.baseurl | prepend: site.url }}</link> | |
<guid isPermaLink="true">{{ post.url | prepend: site.baseurl | prepend: site.url }}</guid> | |
{% for cat in post.categories %} | |
<category>{{ cat | xml_escape }}</category> | |
{% endfor %} | |
</item> | |
{% endfor %} | |
</channel> | |
</rss> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment