Skip to content

Commit

Permalink
Merge pull request #177 from exadel-inc/feature/sitemap
Browse files Browse the repository at this point in the history
Feature/sitemap
  • Loading branch information
Sisha0 authored Oct 8, 2021
2 parents d6572e9 + 56c365a commit 4ced5e2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ module.exports = config => {
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
templateFormats: ['md', 'njk'],
pathPrefix: '/ui-playground/',
};
};
3 changes: 3 additions & 0 deletions pages/views/_data/site.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"url": "https://exadel-inc.github.io/ui-playground"
}
4 changes: 2 additions & 2 deletions pages/views/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ layout: basic
<h3 class="uip-demo__list-title">Samples</h3>
{% for sample in collections.samples %}
<li class="uip-demo__list-item">
<a href="{{ sample.url }}">{{ sample.data.title }}</a>
<a href="{{ sample.url | url }}">{{ sample.data.title }}</a>
</li>
{%- endfor %}
</ul>
Expand All @@ -15,7 +15,7 @@ layout: basic
<h3 class="uip-demo__list-title">Plugins</h3>
{% for plugin in collections.plugins %}
<li class="uip-demo__list-item">
<a href="{{ plugin.url }}">{{ plugin.data.title }}</a>
<a href="{{ plugin.url | url }}">{{ plugin.data.title }}</a>
</li>
{%- endfor %}
</ul>
6 changes: 6 additions & 0 deletions pages/views/robots.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
permalink: "/robots.txt"
eleventyExcludeFromCollections: true
---
User-agent: *
Sitemap: {{ site.url }}/sitemap.xml
18 changes: 18 additions & 0 deletions pages/views/sitemap.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
permalink: "/sitemap.xml"
eleventyExcludeFromCollections: true
---

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for page in collections.all %}
<url>
<loc>{{ site.url }}{{ page.url.replace(r/\/$/, ".html") if page.data.tags else page.url }}</loc>
<lastmod>{{ page.date.toISOString() }}</lastmod>
{%- if page.url == "/" %}
<changefreq>weekly</changefreq>
<priority>1.0</priority>
{%- endif %}
</url>
{% endfor %}
</urlset>

0 comments on commit 4ced5e2

Please sign in to comment.