File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import toc from "markdown-it-table-of-contents"
13
13
import mark from "markdown-it-mark"
14
14
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img"
15
15
import rssPlugin from "@11ty/eleventy-plugin-rss"
16
-
16
+ import link from "./src/_data/link.json" with { type : 'json' }
17
17
dotenv . config ( )
18
18
19
19
export default function ( eleventyConfig ) {
@@ -96,6 +96,12 @@ export default function (eleventyConfig) {
96
96
return date . toISOString ( )
97
97
} )
98
98
99
+ eleventyConfig . addFilter ( "convertToValidURL" , ( url ) => {
100
+ if ( url . startsWith ( 'http' ) ) return url
101
+ const validURL = new URL ( url , ( isDevelopment ) ? "http://localhost" : link . website )
102
+ return validURL
103
+ } )
104
+
99
105
eleventyConfig . addFilter ( "postYear" , ( dateObj ) => {
100
106
return DateTime . fromJSDate ( dateObj ) . toLocaleString ( { year : "numeric" } )
101
107
} )
Original file line number Diff line number Diff line change 31
31
<meta property =" og:url" content =" https://emptywork.my.id" />
32
32
<meta property =" og:site_name" content =" EmptyWork" />
33
33
{% if image %}
34
- <meta property =" og:image" content =" {{ image }}" />
35
- <meta itemprop =" image" content =" {{ image }}" />
36
- <meta name =" twitter:image" content =" {{ image }}" />
34
+ <meta property =" og:image" content =" {{ image | convertToValidURL }}" />
35
+ <meta itemprop =" image" content =" {{ image | convertToValidURL }}" />
36
+ <meta name =" twitter:image" content =" {{ image | convertToValidURL }}" />
37
37
{% else %}
38
38
<meta itemprop =" image"
39
- content =" /images/emptywork.my.id-secondary-banner.png" />
39
+ content =" {{ link.website | development }} /images/emptywork.my.id-secondary-banner.png" />
40
40
<meta property =" og:image"
41
- content =" /images/emptywork.my.id-secondary-banner.png" />
41
+ content =" {{ link.website | development }} /images/emptywork.my.id-secondary-banner.png" />
42
42
<meta name =" twitter:image"
43
- content =" /images/emptywork.my.id-secondary-banner.png" />
43
+ content =" {{ link.website | development }} /images/emptywork.my.id-secondary-banner.png" />
44
44
{% endif %}
45
45
<meta name =" twitter:card" content =" summary_large_image" />
46
46
{% if title %}
You can’t perform that action at this time.
0 commit comments