File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
const lodashGet = require ( "lodash/get" ) ;
2
2
const yaml = require ( "js-yaml" ) ;
3
+ const { URL } = require ( "url" ) ;
3
4
4
5
module . exports = function ( eleventyConfig ) {
5
6
// Support yaml data files
@@ -38,6 +39,10 @@ module.exports = function (eleventyConfig) {
38
39
return md . render ( content ) ;
39
40
} ) ;
40
41
42
+ eleventyConfig . addFilter ( 'absoluteUrl' , ( url , base ) => {
43
+ return ( new URL ( url , base ) ) . toString ( ) || url
44
+ } )
45
+
41
46
42
47
eleventyConfig . addFilter ( 'convertFromEpoc' , ( time ) => {
43
48
let date = new Date ( 0 ) ;
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ lang : "en" ,
3
+ url : process . env . URL || "http://localhost:8080" ,
4
+ } ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ ogimage: "/img/og/default-og-image.png"
5
5
---
6
6
7
7
<!doctype html>
8
- <html lang =" en " >
8
+ <html lang =" {{ meta.lang }} " >
9
9
<head >
10
10
<meta charset =" utf-8" >
11
11
<meta name =" viewport" content =" width=device-width, initial-scale=1.0" >
@@ -18,7 +18,7 @@ ogimage: "/img/og/default-og-image.png"
18
18
<link rel =" apple-touch-icon" sizes =" 180x180" href =" /img/favicons/apple-touch-icon.png" >
19
19
<link rel =" icon" type =" image/png" sizes =" 32x32" href =" /img/favicons/favicon-32x32.png" >
20
20
<link rel =" icon" type =" image/png" sizes =" 16x16" href =" /img/favicons/favicon-16x16.png" >
21
- <link rel =" canonical" href =" https://jamstack.org {{ page.url }}" />
21
+ <link rel =" canonical" href =" {{ page.url | url | absoluteUrl(meta.url) }}" />
22
22
{%- for url in preconnect %}
23
23
<link rel =" preconnect" href =" {{ url }}" >
24
24
{%- endfor %}
You can’t perform that action at this time.
0 commit comments