Skip to content

Commit 40485af

Browse files
committed
add robots.txt & sitemap
1 parent 888c505 commit 40485af

File tree

9 files changed

+48
-14
lines changed

9 files changed

+48
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ jobs:
66
build:
77
runs-on: ubuntu-latest
88
permissions:
9-
contents: write
9+
contents: read
1010
steps:
1111
- uses: actions/checkout@v6
1212
- uses: pnpm/action-setup@v4
1313
with:
14-
version: 8
14+
version: 10
1515
- uses: actions/setup-node@v6
1616
with:
1717
node-version: 22

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,25 @@
88
## How it works
99

1010
- the contents of each page are stored in [yaml](https://yaml.org/) format in [src/content](/src/content)
11-
- there is a corresponding [pug](https://pugjs.org/) HTML template for each page in [src/pug](/src/pug)
11+
- there is a corresponding [Nunjucks](https://mozilla.github.io/nunjucks/) HTML template for each page in [src/pages](/src/pages)
1212
- uses CSS and icons from the [Bootstrap](https://getbootstrap.com/) framework
1313
- uses [pnpm](https://pnpm.io/) and [webpack](https://webpack.js.org/) to manage the build and dependencies
14+
- uses [Eleventy](https://www.11ty.dev/) as the static site generator
1415

1516
## Structure
1617

1718
- [src/content](/src/content)
1819
- each page has a yaml file with the content for that page
19-
- this data is made available as `content` to the pug template of the same name
20-
- [src/pug](/src/pug)
21-
- each page has a [pug](https://pugjs.org/) template
20+
- this data is made available to the Nunjucks template of the same name
21+
- [src/pages](/src/pages)
22+
- each page has a [Nunjucks](https://mozilla.github.io/nunjucks/) template (`.njk`)
2223
- the html page is generated from this template
23-
- it inherits the base layout from [src/pug/layouts/base.pug](/src/pug/layouts/base.pug)
24-
- it can use functions ('mixins') from [src/pug/mixins](/src/pug/mixins)
24+
- it inherits the base layout from [src/pages/\_includes/layouts/base.njk](/src/pages/_includes/layouts/base.njk)
25+
- it can use functions ('macros') from [src/pages/\_includes/macros](/src/pages/_includes/macros)
2526
- [src/assets](/src/assets)
2627
- contains the image and video files
27-
- [src/scss](/src/scss)
28-
- import and customize [Bootstrap css](https://getbootstrap.com/docs/5.3/customize/sass/)
28+
- [src/css](/src/css)
29+
- custom CSS styles
2930
- [src/js](/src/js)
3031
- additional client-side javascript
3132
- [src/index.js](/src/index.js)
@@ -58,8 +59,9 @@ On every commit to the main branch:
5859

5960
To add a page `X`:
6061

61-
- create a text file `src/pug/X.pug` with the contents `extends layouts/base`
6262
- create a text file `src/content/X.yml` with the contents `page_title: "X"`
63+
- create a text file `src/pages/X.njk` that extends the base layout
64+
- create a text file `src/pages/X.11tydata.js` with the contents `module.exports = require("./_helpers/loadContent")("X.yml");`
6365
- add an entry for it to the list of pages in [src/content/navbar.yml](src/content/navbar.yml)
6466

6567
## Acknowledgements
File renamed without changes.

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import "bootstrap/js/dist/modal";
88
// import CSS
99
import "bootstrap/dist/css/bootstrap.min.css";
1010
import "bootstrap-icons/font/bootstrap-icons.min.css";
11-
import "./scss/styles.css";
11+
import "./css/styles.css";
1212

1313
// import custom js
1414
import "./js/modal_on_pageload";

src/pages/_includes/macros/image_carousel.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{% if '.png' in image_file %}
1515
<source srcset="assets/{{ image_file | replace('.png', '.webp') }}" type="image/webp">
1616
{% endif %}
17-
<img class="d-block mx-auto w-100" src="assets/{{ image_file }}" alt="{{ image_file }}">
17+
<img class="d-block mx-auto w-100" src="assets/{{ image_file }}" alt="{{ image_file }}" loading="lazy">
1818
</picture>
1919
</div>
2020
{% endfor %}

src/pages/index.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
</div>
3030
</section>
3131
<div class="container text-center">
32-
<img class="w-25" src="assets/BMBF_logo_en.jpeg" alt="BMBF logo">
32+
<img class="w-25" src="assets/BMBF_logo_en.jpeg" alt="BMBF logo" loading="lazy">
3333
</div>
3434
{% endblock %}

src/pages/robots.njk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
permalink: /robots.txt
3+
eleventyExcludeFromCollections: true
4+
---
5+
User-agent: *
6+
Allow: /
7+
8+
Sitemap: https://spatial-model-editor.github.io/sitemap.xml

src/pages/sitemap.11tydata.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
const YAML = require("yaml");
4+
5+
const contentDir = path.resolve(__dirname, "../content");
6+
const navbarData = YAML.parse(
7+
fs.readFileSync(path.join(contentDir, "navbar.yml"), "utf8"),
8+
);
9+
10+
module.exports = {
11+
navbar: navbarData,
12+
};

src/pages/sitemap.njk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
permalink: /sitemap.xml
3+
eleventyExcludeFromCollections: true
4+
---
5+
<?xml version="1.0" encoding="UTF-8"?>
6+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
7+
{% for name, url in navbar.pages %}
8+
<url>
9+
<loc>https://spatial-model-editor.github.io/{{ url }}</loc>
10+
</url>
11+
{% endfor %}
12+
</urlset>

0 commit comments

Comments
 (0)