samarsault / plainwhite-jekyll

A configurable portfolio-style jekyll theme for writers.
https://samarsault.com
MIT License
460 stars 480 forks source link

Sitemap showing 404 #50

Closed lpsouza closed 4 years ago

lpsouza commented 4 years ago

Hello!

I am using this theme in remote configuration mode and I configure the option in my _config.yml:

plainwhite:
    sitemap: true

But if I access the URL https://luizsouza.com/sitemap.xml shows the Github Pages 404 error.

How I can resolve this problem? 🤔

DotIN13 commented 4 years ago

Make sure you have sitemap.xml file in your root folder with the following content.

---
layout: null
---
{%-if site.plainwhite.sitemap -%}
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset
        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
                http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
        <url>
            <loc>{{ site.url }}</loc>
            <lastmod>2019-06-07T00:00:00+00:00</lastmod>
            <priority>1.00</priority>
        </url>
        {%- for post in site.posts -%}
            <url>
                <loc>{{ site.url }}{{ post.url }}</loc>
                <lastmod>{{ post.date | date_to_xmlschema }}</lastmod>
                <changefreq>weekly</changefreq>
                <priority>0.80</priority>
            </url>
        {%- endfor -%}
    </urlset>    
{%- endif -%}
lpsouza commented 4 years ago

That's it! It's works!

I thought that file works just like others in remote configuration where if missing the theme use the original file from this repository. 😅

Thanks for the tip!