Skip to content

Commit 3235bfd

Browse files
authored
feat: add head meta tags and configuration to support dynamic HTML head content (#51)
1 parent 5704c36 commit 3235bfd

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

lib/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const DEFAULTS = {
1818
template: builder,
1919
indicies,
2020
bots: true,
21+
head: [],
2122
title: 'StatusBoard',
2223
description: 'Project StatusBoard',
2324
issueLabels: ['top priority', 'good first issue', 'help wanted', 'discussion', 'meeting']
@@ -40,6 +41,7 @@ class Config {
4041
// All the dynamic stuff for a project
4142
this.title = opts.title || DEFAULTS.title
4243
this.description = opts.description || DEFAULTS.description
44+
this.head = opts.head || DEFAULTS.head
4345

4446
// Include bots in stats
4547
this.bots = opts.bots === undefined ? DEFAULTS.bots : opts.bots

template/index.html

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@
55
<title><%= title %></title>
66
<meta name="description" content="<%= description %>">
77
<meta name="viewport" content="width=device-width, initial-scale=1">
8-
9-
<!-- <link rel="manifest" href="site.webmanifest"> -->
10-
<!-- <link rel="apple-touch-icon" href="icon.png"> -->
8+
<meta name="robots" content="index, follow" />
9+
<meta name="googlebot" content="index, follow" />
1110
<meta name="theme-color" content="#fafafa">
12-
<!-- Place favicon.ico in the root directory -->
11+
12+
<meta property="og:type" content="website" />
13+
<meta property="og:title" content="<%= title %>" />
14+
<meta property="og:description" content="<%= description %>" />
15+
16+
<meta name="twitter:title" content="<%= title %>" />
17+
<meta name="twitter:description" content="<%= description %>" />
18+
19+
<%- head.join('\n') %>
1320

1421
<link href="<%= files.css.index %>" rel="stylesheet" />
1522
<script>

test/fixtures/config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ module.exports = {
1111

1212
title: 'StatusBoard Test',
1313
description: 'A test for StatusBoard',
14-
14+
head: [
15+
'<link rel="me" href="https://social.lfx.dev/@nodejs" />',
16+
'<meta name="fediverse:creator" content="@nodejs@social.lfx.dev" />'
17+
],
1518
orgs: [
1619
'pkgjs'
1720
],

0 commit comments

Comments
 (0)