${metadata.title}
${metadata.image ? `` : ``}${metadata.description ? `${metadata.description}
` : ""}// ocoge start const md = require('markdown-it')({ html: true }); // const EleventyFetch = require("@11ty/eleventy-fetch"); const metascraper = require('metascraper')([ require('metascraper-description')(), require('metascraper-image')(), require('metascraper-logo')(), require('metascraper-logo-favicon')(), require('metascraper-publisher')(), require('metascraper-title')(), require('metascraper-url')() ]); const got = require('got'); // ocoge end module.exports = (config) => { config.addPassthroughCopy('src/assets/img/**/*'); config.addPassthroughCopy({ 'src/posts/img/**/*': 'assets/img/' }); config.addWatchTarget("src/assets/js/"); config.addLayoutAlias('default', 'layouts/default.njk'); config.addLayoutAlias('post', 'layouts/post.njk'); config.addFilter('readableDate', require('./lib/filters/readableDate')); config.addFilter('minifyJs', require('./lib/filters/minifyJs')); config.addTransform('minifyHtml', require('./lib/transforms/minifyHtml')); config.addCollection('posts', require('./lib/collections/posts')); config.addCollection('tagList', require('./lib/collections/tagList')); config.addCollection('pagedPosts', require('./lib/collections/pagedPosts')); config.addCollection('pagedPostsByTag', require('./lib/collections/pagedPostsByTag')); // ocoge start config.addPassthroughCopy({ 'src/assets/oc-css/**/*': 'assets/css/' }); config.addPassthroughCopy('src/assets/floatbox/**/*'); const { execSync } = require('child_process'); // Shortcodes // 注釈 var ann = 0; config.addShortcode('annotate', conf => { if (conf) ann = 1; else ann++; let n = String(ann); return `${n}`; }); var sm = 0; config.addPairedShortcode('small', (content, conf) => { if (conf) sm = 1; else sm++; content = md.renderInline(content); return `${sm}. ${content}`; }); // キャプション付きセンタリング画像 config.addPairedShortcode('centerimg', (content, img) => { content = md.renderInline(content); return ``; }); // インライン画像 config.addShortcode('inlineimg', conf => { return ``; }); // 単純なボックス config.addPairedShortcode('simplebox', (content, cls) => { content = md.renderInline(content); return `
${content}
${content}
404
'; } const metadata = await metascraper({ html, url }); // uri に "localhost" を使えるようにする:ポート80 でローカルwebサーバを立てておく // なんか勝手に localhost が ocoge.club に書き換わるのでそちらも対策 if (metadata.url) { metadata.url = metadata.url.replace('http://localhost', ''); metadata.url = metadata.url.replace('https://ocoge.club', ''); } if (metadata.image) { metadata.image = metadata.image.replace('http://localhost', ''); metadata.image = metadata.image.replace('https://ocoge.club', ''); } if (metadata.logo) { metadata.logo = metadata.logo.replace('http://localhost', ''); metadata.logo = metadata.logo.replace('https://ocoge.club', ''); } return `${metadata.description}
` : ""}${metadata.data.description}
` : ""} // // ${metadata.data.logo ? `` : ""} // ${metadata.data.publisher ? `${metadata.data.publisher}` : ""} //${conf.name ? conf.name : ''}
${conf.name ? conf.name : ''}
${content}
${content}