Skip to content

Commit

Permalink
Add <meta name="generator"> tags to generated HTML (#757)
Browse files Browse the repository at this point in the history
The Agolia team has requested that we add <meta name="generator">
(#754) tags to identify pages generated by MarkBind. Since this tag is
part of HTML5 [1] and can be used by other external providers to
identify MarkBind generated sites, we can include this tag in all
MarkBind pages. We can also include the version number to allow
tracking the use of different MarkBind versions, as other projects
have done [2, 3].

Let's include the <meta name="generator"> tag to identify MarkBind
pages, as well as including the version number to track the use of
different MarkBind versions.

[1]: https://www.w3.org/TR/html5/document-metadata.html#generator
[2]: hexojs/site#649
[3]: gatsbyjs/gatsby#8221
  • Loading branch information
Xenonym authored and yamgent committed Mar 14, 2019
1 parent 33a9ab0 commit 07814ff
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const logger = require('./util/logger');
const MarkBind = require('./lib/markbind/src/parser');
const md = require('./lib/markbind/src/lib/markdown-it');

const CLI_VERSION = require('../package.json').version;

const FOOTERS_FOLDER_PATH = '_markbind/footers';
const HEAD_FOLDER_PATH = '_markbind/head';
const LAYOUT_DEFAULT_NAME = 'default';
Expand Down Expand Up @@ -238,6 +240,7 @@ Page.prototype.prepareTemplateData = function () {
faviconUrl: this.faviconUrl,
headFileBottomContent: this.headFileBottomContent,
headFileTopContent: this.headFileTopContent,
markBindVersion: `MarkBind ${CLI_VERSION}`,
pageNav: this.isPageNavigationSpecifierValid(),
siteNav: this.frontMatter.siteNav,
title: prefixedTitle,
Expand Down
1 change: 1 addition & 0 deletions src/template/page.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<%- headFileTopContent %>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="<%- markBindVersion %>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><%= title %></title>
<link rel="stylesheet" href="<%- asset.bootstrap %>">
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_site/expected/bugs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta name="default-head-top">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Open Bugs</title>
<link rel="stylesheet" href="../markbind/css/bootstrap.min.css">
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_site/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<!-- End of top level head file content insertion -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World</title>
<link rel="stylesheet" href="markbind/css/bootstrap.min.css">
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_site/expected/sub_site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta name="default-head-top">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="../markbind/css/bootstrap.min.css">
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_site/expected/testAfterSetup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta name="head-top">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World</title>
<link rel="stylesheet" href="markbind/css/bootstrap.min.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta name="default-head-top">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World</title>
<link rel="stylesheet" href="markbind/css/bootstrap.min.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta name="default-head-top">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World</title>
<link rel="stylesheet" href="markbind/css/bootstrap.min.css">
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_site/expected/testLayouts.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World</title>
<link rel="stylesheet" href="markbind/css/bootstrap.min.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World</title>
<link rel="stylesheet" href="markbind/css/bootstrap.min.css">
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_site/expected/test_md_fragment.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta name="default-head-top">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 1.20.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="markbind/css/bootstrap.min.css">
Expand Down

0 comments on commit 07814ff

Please sign in to comment.