Open MichaelCurrin opened 3 years ago
Here is the full output when I ran locally. Just the URLs matter. Note that I don't have author set up on my site.
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Jekyll Blog Demo</title>
<description>Starter for a static website or blog - built with Jekyll, a minimal theme and GH Pages</description>
<link>https://michaelcurrin.github.io/jekyll-blog-demo/</link>
<atom:link href="https://michaelcurrin.github.io/jekyll-blog-demo/atom.xml" rel="self" type="application/rss+xml" />
<author>
<name></name>
<email></email>
<uri></uri>
</author>
<item>
<title>First post!</title>
<description><p>This is my first post after the one created as part of the blog template.</p>
</description>
<pubDate>Sat, 22 Dec 2018 00:00:00 +0200</pubDate>
<link>https://michaelcurrin.github.io/jekyll-blog-demo/2018/12/22/first-post/</link>
<link href="https://michaelcurrin.github.io/jekyll-blog-demo/2018/12/22/first-post/"/>
<guid isPermaLink="true">https://michaelcurrin.github.io/jekyll-blog-demo/2018/12/22/first-post/</guid>
</item>
<item>
<title>Welcome to Jekyll!</title>
<description><p>You’ll find this post in your <code class="language-plaintext highlighter-rouge">_posts</code> directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run <code class="language-plaintext highlighter-rouge">jekyll serve</code>, which launches a web server and auto-regenerates your site when a file is updated.</p>
<p>To add new posts, simply add a file in the <code class="language-plaintext highlighter-rouge">_posts</code> directory that follows the convention <code class="language-plaintext highlighter-rouge">YYYY-MM-DD-name-of-post.ext</code> and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.</p>
<p>Jekyll also offers powerful support for code snippets.</p>
<p>Using backticks.</p>
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s2">"Hi, </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
<span class="n">print_hi</span><span class="p">(</span><span class="s1">'Tom'</span><span class="p">)</span>
<span class="c1">#=&gt; prints 'Hi, Tom' to STDOUT.</span>
</code></pre></div></div>
<p>Using <code class="language-plaintext highlighter-rouge">highlight</code>.</p>
<figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="k">def</span> <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s2">"Hi, </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
<span class="n">print_hi</span><span class="p">(</span><span class="s1">'Tom'</span><span class="p">)</span>
<span class="c1">#=&gt; prints 'Hi, Tom' to STDOUT.</span></code></pre></figure>
<p>Check out the <a href="https://jekyllrb.com/docs/home">Jekyll docs</a> for more info on how to get the most out of Jekyll. File all bugs/feature requests at <a href="https://github.com/jekyll/jekyll">Jekyll’s GitHub repo</a>. If you have questions, you can ask them on <a href="https://talk.jekyllrb.com/">Jekyll Talk</a>.</p>
</description>
<pubDate>Tue, 18 Dec 2018 18:24:52 +0200</pubDate>
<link>https://michaelcurrin.github.io/jekyll-blog-demo/jekyll/update/2018/12/18/welcome-to-jekyll/</link>
<link href="https://michaelcurrin.github.io/jekyll-blog-demo/jekyll/update/2018/12/18/welcome-to-jekyll/"/>
<guid isPermaLink="true">https://michaelcurrin.github.io/jekyll-blog-demo/jekyll/update/2018/12/18/welcome-to-jekyll/</guid>
</item>
</channel>
</rss>
Also by the way it looks weird that the live atom.xml page in your linked site uses a completely different format. e.g. feed
and entry
, which are not in the atom file I edited.
Refactor
Adding
site.url
is not a good pattern in Jekyll.In particular, if someone uses this repo on a subpath, the code would break, because
site.url
does not includesite.baseurl.
If you do this:
That uses the site.url and site.baseurl values for you
e.g. I tested locally and got:
I also refactored the other parts not around posts, to use
absolute_url
.Note that when running locally you should do this, so that
site.url
is used as domain instead of localhost.Fix
I replaced feed.xml with atom.xml in the file.