Day31
こんな感じの関数でNuxt.jsにわたすhead用のオブジェクトを作成している。
export interface CreateHeadOptions {
title?: string
description?: string
image?: string
}
export function createHead(options: CreateHeadOptions) {
const head: any = { meta: [] }
if (options.title) {
const title = `${options.title} - 質問サービスタイトル未定`
head.title = title
head.meta.push({ hid: 'og:title', property: 'og:title', content: title })
}