@@ -276,12 +276,15 @@ export async function exporter(argument: ProjectExportArguments, json: any) {
276276 const html = `<!DOCTYPE html>
277277<html>
278278<head>
279+ <meta charset="UTF-8">
279280 <title>${ title } </title>
280281
281282 <script type="application/ld+json">
282283 ${ JSON . stringify ( jsonLD , null , 2 ) }
283284 </script>
284285
286+ ${ argument [ 'project-no-meta' ] ? '' : meta ( json ) }
287+
285288 ${
286289 json . icon
287290 ? '<link rel="icon" type="image/x-icon" href="' + json . icon + '">'
@@ -485,22 +488,40 @@ function cleanHTML(html: string) {
485488}
486489
487490function meta ( json : any ) {
488- const title =
489- json . meta ?. title || cleanHTML ( json . title ) || 'LiaScript Course Index'
491+ const title = (
492+ json . meta ?. title ||
493+ cleanHTML ( json . title ) ||
494+ 'LiaScript Course Index'
495+ ) . trim ( )
496+
497+ let metaData = `<meta property="og:type" content="website">
498+ <meta property="og:title" content="${ title } ">
499+ <meta name="twitter:title" content="${ title } ">
500+ `
490501
491- const description = json . meta ?. description || cleanHTML ( json . comment )
502+ const description = (
503+ json . meta ?. description ||
504+ cleanHTML ( json . comment ) ||
505+ ''
506+ ) . trim ( )
492507
493- const image = json . meta ?. image || json . logo
508+ if ( description ) {
509+ metaData += `<meta name="description" content="${ description } ">
510+ <meta property="og:description" content="${ description } ">
511+ <meta name="twitter:description" content="${ description } ">
512+ `
513+ }
494514
495- return `<meta property="og:type" content="website">
496- <meta property="og:title" content="${ title } ">
497- <meta property="og:description" content="${ description } ">
498- <meta property="og:image" content="${ image } ">
515+ const image = ( json . meta ?. image || json . logo || '' ) . trim ( )
516+
517+ if ( image ) {
518+ metaData += `<meta property="og:image" content="${ image } ">
519+ <meta name="twitter:card" content="summary_large_image">
520+ <meta name="twitter:image" content="${ image } ">
521+ `
522+ }
499523
500- <meta name="twitter:title" content="${ title } ">
501- <meta name="twitter:description" content="${ description } ">
502- <meta name="twitter:image" content="${ image } ">
503- `
524+ return metaData
504525}
505526
506527function overwrite ( check , defaultsTo ) {
0 commit comments