Skip to content

Commit 318b808

Browse files
committed
add robot and sitemap
1 parent 331712f commit 318b808

6 files changed

Lines changed: 99 additions & 9 deletions

File tree

.eleventy.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
module.exports = function (eleventyConfig) {
2-
// Copy the folder and keep the same name inside _site/
3-
eleventyConfig.addPassthroughCopy("content/assets");
1+
const sitemap = require("@quasibit/eleventy-plugin-sitemap");
2+
3+
module.exports = function(eleventyConfig) {
4+
// create sitemap
5+
eleventyConfig.addPlugin(sitemap, {
6+
sitemap: {
7+
hostname: "https://metelkin.me"
8+
}
9+
});
410

5-
/* If you’d rather strip the “content/” part so the result is
6-
_site/assets/…, map input → output like this:
7-
eleventyConfig.addPassthroughCopy({ "content/assets": "assets" });
8-
*/
11+
// copy files to the output directory
12+
eleventyConfig.addPassthroughCopy("content/robots.txt");
13+
eleventyConfig.addPassthroughCopy("content/assets");
914

1015
return {
1116
dir: {

content/_includes/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<meta charset="UTF-8">
1414
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1515
<title>{{ title }}</title>
16-
<link rel="icon" href="/assets/images/favicon.ico" type="image/x-icon">
16+
<link rel="icon" href="/assets/favicon.ico" type="image/x-icon">
1717
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.min.css">
1818
<!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@5.8.1/github-markdown-light.min.css">-->
1919
<style>

content/robots.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
User-agent: *
2+
Allow: /
3+
4+
# Optional—but useful so Google finds it fast
5+
Sitemap: https://metelkin.me/sitemap.xml

content/sitemap.njk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
permalink: /sitemap.xml
3+
layout: null
4+
eleventyExcludeFromCollections: true
5+
---
6+
{% sitemap collections.all %}

package-lock.json

Lines changed: 72 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"license": "CC-BY-4.0",
1414
"dependencies": {
1515
"@11ty/eleventy": "^3.1.2"
16+
},
17+
"devDependencies": {
18+
"@quasibit/eleventy-plugin-sitemap": "^2.2.0"
1619
}
1720
}

0 commit comments

Comments
 (0)