MCPcopy Create free account
hub / github.com/ThatGuySam/doesitarm / PageHead

Class PageHead

helpers/config-node.js:247–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245
246
247export class PageHead {
248
249 constructor ( options = {} ) {
250 const {
251 title,
252 description,
253 meta = [],
254 link = [],
255 structuredData = null,
256
257 domain = getSiteUrl(),
258 pathname = '',
259 } = options
260
261 this.title = title
262 this.description = description
263 this.meta = meta
264 this.link = link
265 this.structuredData = structuredData
266
267 this.domain = domain
268 this.pathname = pathname
269 }
270
271 get pageUrl () {
272 const urlInstance = new URL( this.domain )
273
274 urlInstance.pathname = this.pathname
275
276 return urlInstance
277 }
278
279 get pageUrlString () {
280 return this.pageUrl.toString()
281 }
282
283 get routeType () {
284 if ( this.pathname.length < 2 ) return 'none'
285
286 return getRouteType( this.pathname )
287 }
288
289 get defaultMeta () {
290 return nuxtHead.meta
291 }
292
293 get defaultMetaTags () {
294 return Object.fromEntries( nuxtHead.meta.map( mapMetaTag ) )
295 }
296
297 get defaultLinkTags () {
298 return Object.fromEntries( nuxtHead.link.map( mapLinkTag ) )
299 }
300
301 get pageMeta () {
302 // console.log('this.defaultMeta', this.defaultMeta)
303 return [
304 ...this.defaultMeta,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected