mirror of
https://github.com/tabler/tabler.git
synced 2026-08-05 01:44:41 +04:00
Merge branch 'main' of https://github.com/tabler/tabler into dev
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
---
|
||||
layout: null
|
||||
permalink: robots.txt
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
Sitemap: {% if environment != 'development' %}{{ site.docsUrl }}{% endif %}/sitemap.xml
|
||||
|
||||
{% if environment == 'development' %}
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
{% else %}
|
||||
User-agent: *
|
||||
Disallow:
|
||||
{% endif %}
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
layout: null
|
||||
permalink: sitemap.xml
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset 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" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
|
||||
{% for entry in collections.sitemap %}
|
||||
{% assign path = entry.url | replace: 'index.html', '' %}
|
||||
{% if path == '/' %}
|
||||
{% assign path = '' %}
|
||||
{% endif %}
|
||||
<url>
|
||||
<loc>{% if environment != 'development' %}{{ site.docsUrl }}{% endif %}{{ path | xml_escape }}</loc>
|
||||
<lastmod>{{ entry.last_modified_at | default: 'now' | date_to_xmlschema }}</lastmod>
|
||||
</url>
|
||||
{% endfor %}
|
||||
</urlset>
|
||||
@@ -27,6 +27,17 @@ export default function (eleventyConfig) {
|
||||
});
|
||||
});
|
||||
|
||||
eleventyConfig.addCollection('sitemap', collection => {
|
||||
return [...collection.getFilteredByGlob('./content/**/*.md')].sort((a, b) => {
|
||||
const isHome = (page) => page.url === '/' || page.url === '/index.html';
|
||||
|
||||
if (isHome(a)) return -1;
|
||||
if (isHome(b)) return 1;
|
||||
|
||||
return (a.url || '').localeCompare(b.url || '');
|
||||
});
|
||||
});
|
||||
|
||||
eleventyConfig.setInputDirectory("content");
|
||||
|
||||
eleventyConfig.amendLibrary('md', () => { });
|
||||
|
||||
Reference in New Issue
Block a user