Added the svg icon sprite configuration

This commit is contained in:
Claudia Reynders 2022-04-30 18:38:41 +02:00
parent 42fddb5416
commit 6d358612d8
6 changed files with 47 additions and 6 deletions

View File

@ -8,16 +8,23 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addLayoutAlias('page', 'layouts/page') eleventyConfig.addLayoutAlias('page', 'layouts/page')
eleventyConfig.addLayoutAlias('article', 'layouts/article') eleventyConfig.addLayoutAlias('article', 'layouts/article')
eleventyConfig.addFilter('readableDate', dateObj => { eleventyConfig.addPassthroughCopy('./src/assets/icons')
return DateTime.fromJSDate(dateObj, { eleventyConfig.addPassthroughCopy('./src/assets/sprite.svg')
zone: "Europe/Paris", eleventyConfig.addPassthroughCopy({
}).setLocale('en').toLocaleString(DateTime.DATE_FULL) 'node_modules/svg-icon-sprite/dist/svg-icon-sprite.js': 'assets/svg-icon-sprite.js'
}) })
eleventyConfig.addPassthroughCopy('./src/assets/social-image.jpg')
eleventyConfig.addNunjucksAsyncShortcode('image', require('./src/_11ty/imageShortcode').imageShortcode) eleventyConfig.addNunjucksAsyncShortcode('image', require('./src/_11ty/imageShortcode').imageShortcode)
eleventyConfig.addFilter('readableDate', dateObj => {
return DateTime.fromJSDate(dateObj, {
zone: 'Europe/Paris',
}).setLocale('en').toLocaleString(DateTime.DATE_FULL)
})
/* Creating a collection of blogposts by filtering based on folder and filetype */ /* Creating a collection of blogposts by filtering based on folder and filetype */
eleventyConfig.addCollection("blog", (collectionApi) => { eleventyConfig.addCollection('blog', (collectionApi) => {
return collectionApi.getFilteredByGlob('./src/blog/*.md').reverse() return collectionApi.getFilteredByGlob('./src/blog/*.md').reverse()
}) })
eleventyConfig.addCollection('categoryList', require('./src/_11ty/getCategoryList')) eleventyConfig.addCollection('categoryList', require('./src/_11ty/getCategoryList'))

View File

@ -1,3 +1,16 @@
<footer role="contentinfo"> <footer role="contentinfo">
<p>This project is maintained by <a href="https://twitter.com/mangamaui">Claudia Reynders</a>, since 2022</p> <p>This project is maintained by <span>Claudia Reynders</span>, since 2022.&nbsp; Find me on
<a class="social-media__link"
href="https://twitter.com/womendotcodebe">
<svg-icon
src="/assets/sprite.svg#twitter"
width="16px"
viewBox="0 0 32 32"
aria-hidden="true"
focusable="false"
></svg-icon>
<span class="sr-only">Twitter</span>
</a>
</p>
</footer> </footer>

View File

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✨</text></svg>"> <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✨</text></svg>">
<title>{{ title or metadata.title }}</title> <title>{{ title or metadata.title }}</title>
<script type="module" src="/assets/svg-icon-sprite.js"></script>
</head> </head>
<body> <body>

View File

@ -0,0 +1,8 @@
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg"
width="32"
height="32"
viewBox="0 0 32 32">
<title>twitter</title>
<path d="M32 7.075c-1.175 0.525-2.444 0.875-3.769 1.031 1.356-0.813 2.394-2.1 2.887-3.631-1.269 0.75-2.675 1.3-4.169 1.594-1.2-1.275-2.906-2.069-4.794-2.069-3.625 0-6.563 2.938-6.563 6.563 0 0.512 0.056 1.012 0.169 1.494-5.456-0.275-10.294-2.888-13.531-6.862-0.563 0.969-0.887 2.1-0.887 3.3 0 2.275 1.156 4.287 2.919 5.463-1.075-0.031-2.087-0.331-2.975-0.819 0 0.025 0 0.056 0 0.081 0 3.181 2.263 5.838 5.269 6.437-0.55 0.15-1.131 0.231-1.731 0.231-0.425 0-0.831-0.044-1.237-0.119 0.838 2.606 3.263 4.506 6.131 4.563-2.25 1.762-5.075 2.813-8.156 2.813-0.531 0-1.050-0.031-1.569-0.094 2.913 1.869 6.362 2.95 10.069 2.95 12.075 0 18.681-10.006 18.681-18.681 0-0.287-0.006-0.569-0.019-0.85 1.281-0.919 2.394-2.075 3.275-3.394z"></path>
</svg>

After

Width:  |  Height:  |  Size: 887 B

BIN
src/assets/social-image.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

12
src/assets/sprite.svg Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0">
<symbol id="twitter"
width="32"
height="32"
viewBox="0 0 32 32">
<title>twitter</title>
<path d="M32 7.075c-1.175 0.525-2.444 0.875-3.769 1.031 1.356-0.813 2.394-2.1 2.887-3.631-1.269 0.75-2.675 1.3-4.169 1.594-1.2-1.275-2.906-2.069-4.794-2.069-3.625 0-6.563 2.938-6.563 6.563 0 0.512 0.056 1.012 0.169 1.494-5.456-0.275-10.294-2.888-13.531-6.862-0.563 0.969-0.887 2.1-0.887 3.3 0 2.275 1.156 4.287 2.919 5.463-1.075-0.031-2.087-0.331-2.975-0.819 0 0.025 0 0.056 0 0.081 0 3.181 2.263 5.838 5.269 6.437-0.55 0.15-1.131 0.231-1.731 0.231-0.425 0-0.831-0.044-1.237-0.119 0.838 2.606 3.263 4.506 6.131 4.563-2.25 1.762-5.075 2.813-8.156 2.813-0.531 0-1.050-0.031-1.569-0.094 2.913 1.869 6.362 2.95 10.069 2.95 12.075 0 18.681-10.006 18.681-18.681 0-0.287-0.006-0.569-0.019-0.85 1.281-0.919 2.394-2.075 3.275-3.394z"></path>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 1009 B