Custom Page Title


  • GNU/Linux Admin

    Yes, this is customisable and has been for awhile now.



  • @julian How can I set a custom title for the home page only? Thanks!


  • Swedes

    I must have missed that setting also?

    Site Title and Title Layout

    Should i set this " {pageTitle} | {browserTitle}" to {browserTitle} ??? Or how should it be used?

    I want to keep pageTitle on all the other pages and change the home part on the startpage!

    Any other vars except
    {pageTitle}
    {browserTitle}


  • Swedes

    I guess we will need to stick to Home if we want pagename | *


  • GNU/Linux Admin

    Right, I mean it is customisable only in that you can change the order around. Only values are {pageTitle} and {browserTitle}, not sure if other template values can be used.



  • Please, tell how can I remove "Home | " only from index page. And how can I modify {browserTitle} on custom route? thanks in advice.


  • GNU/Linux Admin

    @dread At this time I do not believe we can customise the title template to only apply to specific pages (not not to a specific page).

    Can you tell me more about how your custom route is defined? Was it via a plugin?



  • This post is deleted!


  • Hi. I`d try

        if (req.path === '/api/' || req.path === '/') {
            meta.config.browserTitle = '{browserTitle}';
            config.browserTitle = meta.config.browserTitle || meta.config.title;
            meta.config.titleLayout = '{browserTitle}';
            config.titleLayout = (meta.config.titleLayout || '{browserTitle}').replace(/{/g, '{').replace(/}/g, '}');
        } 
    

    in src/controllers/api.js where meta configs defined - but it doesn't work( where I can change core files to modify "Home | " from index page? than i'd try

    if (req.path === '/api/' || req.path === '/') {
    		config.titleLayout = (meta.config.titleLayout || '{browserTitle}').replace(/{/g, '{').replace(/}/g, '}')
    			.replace(/|/g, '').replace(/|/g, '').replace(/\|/g, '');
    } else {
    		config.titleLayout = (meta.config.titleLayout || '{pageTitle} | {browserTitle}').replace(/{/g, '{').replace(/}/g, '}');
    	} 
    

    after "home": " " in pages.json but I had only "| NodeBB"
    also I saw https://github.com/julianlam/nodebb-plugin-canned-responses/blob/master/library.js and your hook addTitles but I dont understand how can i modify <title> on main page with this hook after I choose it with titleMatch = /^/api/$/ or titleMatch = /^/$/
    thanks.



  • Yiiii!)) Thanks a lot for the "Title of the home page" in admin panel!!


Log in to reply
 

Suggested Topics

| |