@@ -21,6 +21,7 @@ module.exports = (eleventyConfig) => {
2121 eleventyConfig . addFilter ( "date_to_rfc3339" , rss . dateToRfc3339 )
2222 eleventyConfig . addFilter ( "date_to_rfc822" , rss . dateToRfc822 )
2323 eleventyConfig . addFilter ( "html_to_absolute_urls" , rss . convertHtmlToAbsoluteUrls )
24+ eleventyConfig . addFilter ( "domain" , ( str ) => new URL ( str ) . hostname )
2425
2526 eleventyConfig . setLibrary (
2627 "md" ,
@@ -40,12 +41,12 @@ module.exports = (eleventyConfig) => {
4041 eleventyConfig . addGlobalData ( "discord" , "https://discord.gg/CqhDNXepDV" )
4142 eleventyConfig . addGlobalData ( "baseurl" , "https://webcomponents.guide" )
4243 eleventyConfig . addGlobalData ( "repository" , "https://github.com/WebComponentsGuide/webcomponents.guide" )
44+ eleventyConfig . addGlobalData ( "mastodon" , "https://fosstodon.org/@webcomponentsguide" )
4345
4446 const customGroups = require ( "./_data/groups.json" )
4547
4648 for ( const [ type , groups ] of Object . entries ( customGroups ) ) {
4749 for ( const group of groups ) {
48- console . log ( `adding ${ type } ${ group } ` )
4950 eleventyConfig . addCollection ( group , ( api ) => {
5051 return api
5152 . getFilteredByGlob ( `${ type } /**/*.md` )
@@ -61,7 +62,8 @@ module.exports = (eleventyConfig) => {
6162
6263 const icon = ( icon ) =>
6364 `<svg width="24" height="24" class="icon icon-${ icon } "><use xlink:href="/images/icons.svg#${ icon } "></use></svg>`
64- const callout = ( content , style = "info" ) => dedent `
65+ const callout = ( content , style = "info" ) =>
66+ dedent `
6567 <div class="callout ${ style } ">
6668 ${ content }
6769 ${ icon ( style ) }
@@ -82,12 +84,12 @@ module.exports = (eleventyConfig) => {
8284 menu : icon ( "menu" ) ,
8385 }
8486 const menu = ( first , ...rest ) => [ menumap [ first ] || `<strong>${ first } </strong>` , ...rest ] . join ( icon ( "chevron-right" ) )
85- const picture = ( name ) => `
86- <picture>
87- <source srcset="/images/${ name } .avif" type="image/avif">
88- <source srcset="/images/${ name } .webp" type="image/webp">
89- <img src="/images/${ name } .jpg">
90- </picture>
87+ const picture = ( name ) =>
88+ ` <picture>
89+ <source srcset="/images/${ name } .avif" type="image/avif">
90+ <source srcset="/images/${ name } .webp" type="image/webp">
91+ <img src="/images/${ name } .jpg">
92+ </picture>
9193 `
9294
9395 eleventyConfig . addShortcode ( "icon" , icon )
@@ -140,7 +142,6 @@ module.exports = (eleventyConfig) => {
140142${ html }
141143</div>
142144 `
143- console . log ( out )
144145 return out
145146 } )
146147}
0 commit comments