try to optimize some configs
TODO: this still doesnt fix the crash during serve issue for all posts somehow
This commit is contained in:
		
							parent
							
								
									ed109e4916
								
							
						
					
					
						commit
						b62a47f600
					
				
					 3 changed files with 13 additions and 8 deletions
				
			
		
							
								
								
									
										10
									
								
								.eleventy.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								.eleventy.js
									
									
									
									
									
								
							|  | @ -40,12 +40,12 @@ module.exports = function (eleventyConfig) { | |||
| 
 | ||||
|   eleventyConfig.addPassthroughCopy({ "src/static": "/" }); | ||||
| 
 | ||||
|   eleventyConfig.addFilter("date_to_datetime", (obj) => { | ||||
|   eleventyConfig.addFilter("date_to_datetime", async (obj) => { | ||||
|     const date = parseDate(obj); | ||||
|     return date.toISOString(); | ||||
|   }); | ||||
| 
 | ||||
|   eleventyConfig.addFilter("date_formatted", (obj) => { | ||||
|   eleventyConfig.addFilter("date_formatted", async (obj) => { | ||||
|     const date = parseDate(obj); | ||||
| 
 | ||||
|     const month = formatPart({ month: "short" }, date); | ||||
|  | @ -55,18 +55,18 @@ module.exports = function (eleventyConfig) { | |||
|     const minutes = date.getUTCMinutes(); | ||||
| 
 | ||||
|     if (hours != 0 && minutes != 0) { | ||||
| 
 | ||||
|       return `${month} ${day}, ${year} - ${hours}:${minutes} UTC`; | ||||
|     } | ||||
| 
 | ||||
|     return `${month} ${day}, ${year}`; | ||||
|   }); | ||||
| 
 | ||||
|   eleventyConfig.addFilter('urlescape', str => { | ||||
|   eleventyConfig.addFilter('urlescape', async str => { | ||||
|     return str.split('/').map(part => encodeURI(part)).join('/') | ||||
|   }); | ||||
| 
 | ||||
|   eleventyConfig.addFilter("related", function(obj) { | ||||
|   // TODO: possibly turn this into a post processing step instead of a filter (or at least make it a shortcode)
 | ||||
|   eleventyConfig.addFilter("related", async function(obj) { | ||||
|     const post = this.ctx; | ||||
|     const posts = this.ctx.collections.posts.map(post => post.data); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| const cache = new Map(); | ||||
| 
 | ||||
| module.exports = ({ path, check_path = 'src/static/' + path, type = "css"  }) => { | ||||
| module.exports = async ({ path, check_path = 'src/static/' + path, type = "css"  }) => { | ||||
|     // caching hashes significantly speeds up build time
 | ||||
|     var hash = undefined; | ||||
|     if (cache.get(check_path)) { | ||||
|  |  | |||
|  | @ -1,7 +1,12 @@ | |||
| module.exports = (md) => ({ src, alt, caption = '' }) => ` | ||||
| module.exports = (md) => async ({ src, alt, caption = '', type = 'img' }) => ` | ||||
|   <figure> | ||||
|     <div> | ||||
|       <img src="${src}" alt="${alt}" /> | ||||
|     ${ | ||||
|       type == 'video' ?  | ||||
| `<video controls onloadstart="this.volume=0.5">
 | ||||
|   <source src="${src}" type="video/mp4"> | ||||
| </video>` : `<img src="${src}" alt="${alt}" />` | ||||
|     } | ||||
|     </div> | ||||
|     ${caption ? `<figcaption>${md.renderInline(caption)}</figcaption>` : ''} | ||||
|   </figure> | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue