Skip to content

Commit 6522f3c

Browse files
committed
Add robots.txt and sitemap.xml templates for SEO optimization
- Created robots.njk to allow all user agents and specify sitemap location. - Created sitemap.njk to generate an XML sitemap for all HTML pages in the site.
1 parent cc63a38 commit 6522f3c

7 files changed

Lines changed: 73 additions & 5 deletions

File tree

‎src/_data/site.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export default {
2121
name: "Missing Elements",
2222
url: "https://missing-elements.github.io",
2323
github: "https://github.com/missing-elements",
24+
// Google Search Console's code for the site, from the "HTML tag" check of its URL-prefix property,
25+
// https://missing-elements.github.io/: base.njk writes it on every page while it is set.
26+
googleSiteVerification: "_z8PPC9AkWc2rKheTsM0kGmM6UA6FLfgMf0aRxDzULU",
2427
elements: [
2528
{
2629
name: "pdfjs-viewer",
@@ -42,7 +45,7 @@ export default {
4245
// A tool's GitHub link is its source. The build page links the skill's page itself.
4346
tools: [
4447
{
45-
name: "Build an H5P activity",
48+
name: "Build an H5P activity with AI",
4649
description: "Describe a lesson to an AI chat and get an H5P activity, from a quiz to a branching scenario: play it, and download a .h5p file for Moodle or any other H5P site. Free, and nothing is uploaded.",
4750
page: "/h5p/build/",
4851
repo: "https://github.com/missing-elements/missing-elements.github.io/tree/main/src/h5p/build",

‎src/_includes/base.njk‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,22 @@
1313
<title>{{ title }}</title>
1414
<meta name="description" content="{{ description }}">
1515
<link rel="canonical" href="{{ site.url }}{{ page.url }}">
16+
{%- if site.googleSiteVerification %}
17+
<meta name="google-site-verification" content="{{ site.googleSiteVerification }}">
18+
{%- endif %}
19+
<meta property="og:type" content="website">
20+
<meta property="og:site_name" content="{{ site.name }}">
21+
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
1622
<meta property="og:title" content="{{ title }}">
1723
<meta property="og:description" content="{{ description }}">
24+
{#- The picture a shared link shows, where the page names one (`socialImage` in its front matter). -#}
25+
{%- if socialImage %}
26+
<meta property="og:image" content="{{ site.url }}{{ socialImage.src }}">
27+
<meta property="og:image:width" content="{{ socialImage.width }}">
28+
<meta property="og:image:height" content="{{ socialImage.height }}">
29+
<meta property="og:image:alt" content="{{ socialImage.alt }}">
30+
<meta name="twitter:card" content="summary_large_image">
31+
{%- endif %}
1832
<link rel="icon" href="/assets/logo.svg" type="image/svg+xml">
1933
<link rel="stylesheet" href="/assets/site.css">
2034
{%- block head %}{% endblock %}

‎src/assets/og-h5p-build.png‎

111 KB
Loading

‎src/assets/site.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ tbody th a:hover code { text-decoration: underline; }
589589

590590
/* A bar at the top, then bands the width of the window, each holding a column of the page's width. */
591591
:root {
592-
--wide: 76rem;
592+
--wide: 85rem;
593593
--gutter: clamp(1rem, 4vw, 3rem);
594594
--band-space: clamp(3.5rem, 2rem + 6vw, 7rem);
595595
}

‎src/h5p/build/index.njk‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
---
22
layout: base.njk
3-
title: Build an H5P activity · Missing Elements
4-
description: Describe a lesson to an AI chat and get an H5P activity to play, a quiz, a branching scenario, an interactive book and more, as a .h5p file for Moodle or any other H5P site. Free, built in your browser, nothing uploaded.
3+
# The title and description carry what people search for: an AI H5P generator, with ChatGPT and the
4+
# like. The description counts the types as the hero does, in the release the page runs.
5+
title: "Free AI H5P generator: make H5P with ChatGPT, Claude or Grok"
6+
eleventyComputed:
7+
description: "Describe a lesson to ChatGPT, Claude or Grok and get an H5P activity: a quiz, a course presentation or any of {{ skill.offered.length }} H5P types. Free, no account, for Moodle."
8+
# The picture a shared link shows: the page's first screen at 1200×630, light, with the sample
9+
# settled. It is a screenshot, so take it again when that screen changes.
10+
socialImage:
11+
src: /assets/og-h5p-build.png
12+
width: 1200
13+
height: 630
14+
alt: "The build page: its headline, Build an H5P activity with AI, and a course presentation playing beside it."
515
# The page's only policy: GitHub Pages sends no headers. base.njk writes it first in <head>, and the
616
# page's inline scripts, the site's color-scheme script and the one below, are added to script-src
717
# by their hashes at build (eleventy.config.js).
@@ -35,7 +45,7 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' da
3545
<section class="hero" aria-labelledby="page-title">
3646
<div class="wrap hero-grid">
3747
<div class="hero-words">
38-
<h1 id="page-title">Build an H5P activity</h1>
48+
<h1 id="page-title">Build an H5P activity with AI</h1>
3949
{#- The types are those the skill's table offers to choose from, in the release the page runs:
4050
counted from it (src/_data/skill.js), and linked at its tag. -#}
4151
<p class="lead when-unlinked">
@@ -301,4 +311,22 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' da
301311
<p>Found a mistake? <a href="https://github.com/missing-elements/missing-elements.github.io/blob/main/{{ page.inputPath | replace('./', '') }}">Edit this page</a> or <a href="https://github.com/missing-elements/h5p-offline-player/issues">open an issue</a>.</p>
302312
</div>
303313
</footer>
314+
{#- What the page is, for a search engine: a free web application for teaching, run in the browser.
315+
It is data, not a script that runs; the policy's hash for it (eleventy.config.js) is unused. -#}
316+
<script type="application/ld+json">
317+
{
318+
"@context": "https://schema.org",
319+
"@type": "WebApplication",
320+
"name": "AI H5P generator",
321+
"alternateName": "Build an H5P activity with AI",
322+
"url": "{{ site.url }}{{ page.url }}",
323+
"description": {{ description | dump | safe }},
324+
"applicationCategory": "EducationalApplication",
325+
"operatingSystem": "Any",
326+
"browserRequirements": "Requires JavaScript",
327+
"isAccessibleForFree": true,
328+
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
329+
"publisher": { "@type": "Organization", "name": "{{ site.name }}", "url": "{{ site.url }}" }
330+
}
331+
</script>
304332
<script type="module" src="/h5p/build/build-page.js"></script>

‎src/robots.njk‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
permalink: /robots.txt
3+
eleventyExcludeFromCollections: true
4+
---
5+
# Everything is open: the h5p-author skill's files too, since a chat's fetch tool may obey this file.
6+
User-agent: *
7+
Allow: /
8+
9+
Sitemap: {{ site.url }}/sitemap.xml

‎src/sitemap.njk‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
permalink: /sitemap.xml
3+
eleventyExcludeFromCollections: true
4+
---
5+
<?xml version="1.0" encoding="utf-8"?>
6+
{#- The site's pages, for search engines: what is written as HTML. A data file such as
7+
/h5p/skill/index.json is a template too, and the skill's files are copied, not written. -#}
8+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
9+
{%- for entry in collections.all %}
10+
{%- if entry.outputPath and entry.outputPath.endsWith(".html") %}
11+
<url><loc>{{ site.url }}{{ entry.url }}</loc></url>
12+
{%- endif %}
13+
{%- endfor %}
14+
</urlset>

0 commit comments

Comments
 (0)