question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set `titleTemplate` as function

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v14.19.2
  • Nuxt Version: 3.0.0-rc.3
  • Package Manager: yarn@1.22.18
  • Builder: vite
  • User Config: modules, target, app, content, css, build
  • Runtime Modules: @nuxt/content-edge@2.0.0-27541979.40705ae
  • Build Modules: -

Reproduction

N/A

Describe the bug

Cannot set the titleTemplate as a function (used for default titles when non existent).

Example:

import { defineNuxtConfig } from 'nuxt'

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
    app: {
        head: {
            titleTemplate: (titleChunk) => {
                return titleChunk ? `${titleChunk} - Site Title` : 'Site Title';
            },
        }
    }
})

Additional context

As far as I know, Nuxt 3 uses vue-meta, which the docs show it supports: https://vue-meta.nuxtjs.org/api/#titletemplate

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
heychazzacommented, May 16, 2022

Like this: https://stackblitz.com/edit/github-d1ngrx?file=app.vue,plugins%2Ftitle.ts

Oh wow, that’s amazing thanks for providing an example, will look to PR this into the docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NuxtJS page title not change - Stack Overflow
Your nuxt.config.js override title set in your page. You should use titleTemplate in nuxt.config.js : head: { titleTemplate(titleChunk) ...
Read more >
Create a title template in Motion - Apple Support
In Motion, the Final Cut Title template creates a custom title that can be applied to clips in the Final Cut Pro timeline....
Read more >
dxPopup – How to keep the close button when using the title ...
Hi, Can you show me an example of keeping the X on the upper right of popup-title when adding a titleTemplate $("#popupContainer").dxPopu.
Read more >
ContentDialog Class (Windows.UI.Xaml.Controls)
This example shows how to create a ContentDialog in the XAML of an app page. ... The TitleTemplate property is used to create...
Read more >
3D title template error - magix.info
Hi and welcome to the user to user forums. I don't know if this is the same issue but about three Windows updates...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found