mirror of https://gitlab.com/curben/blog
fix(opengraph): don't lazy load cheerio
This commit is contained in:
parent
b7167f289a
commit
f2e4f12358
|
@ -11,7 +11,7 @@
|
||||||
const urlFn = require('url')
|
const urlFn = require('url')
|
||||||
const moment = require('moment')
|
const moment = require('moment')
|
||||||
const { escapeHTML, htmlTag, stripHTML } = require('hexo-util')
|
const { escapeHTML, htmlTag, stripHTML } = require('hexo-util')
|
||||||
let cheerio
|
const cheerio = require('cheerio')
|
||||||
|
|
||||||
function meta (name, content, escape) {
|
function meta (name, content, escape) {
|
||||||
if (escape !== false && typeof content === 'string') {
|
if (escape !== false && typeof content === 'string') {
|
||||||
|
@ -36,8 +36,6 @@ function og (name, content, escape) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openGraphHelper (options = {}) {
|
function openGraphHelper (options = {}) {
|
||||||
if (!cheerio) cheerio = require('cheerio')
|
|
||||||
|
|
||||||
const { config, page, theme } = this
|
const { config, page, theme } = this
|
||||||
const { content } = page
|
const { content } = page
|
||||||
let images = page.photos || []
|
let images = page.photos || []
|
||||||
|
|
Loading…
Reference in New Issue