Explore the community Forums Lectora Lectora Questions & Answers Add title-name to html-title-tag?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #298691 Score: 0
    Profile photo of Reiner Fuest
    Reiner Fuest
    Member
    beginner
    intermediate
    contributor
    @rfuest6134

    Opening the published title in a browser, the browser shows page names as they are used for the title-tag in html.

    Can I add the lectora-title to the title-tag?

    When naming the module “OSA_02_MST” (Title-Options / Name) the browser should show “OSA_02_MST: Start” not only “Start”. Renaming the pages is not an option, because of the menu used.

    (See screenshot for explanation.)

    • This topic was modified 5 years, 1 month ago by Profile photo of Reiner Fuest Reiner Fuest.
    #298694 Score: 0
    Profile photo of Reiner Fuest
    Reiner Fuest
    Member
    beginner
    intermediate
    contributor
    @rfuest6134

    By the way: using JavaScript in a main action to rewrite the page title for every page is not the solution I am searching for:

    document.title = “OSA-MST: ” + VarCurrentPageName.getValue();

    Because rewriting happens at the client side after processing the page. Web server statistics still lists pages – even from different modules – as “Start” without the name of the module “OSA-MST: Start”.

    #298695 Score: 0
    Profile photo of Reiner Fuest
    Reiner Fuest
    Member
    beginner
    intermediate
    contributor
    @rfuest6134

    Finally: JavaScript will do the job. Combining my name changing script an the Piwik tracking code, I can force the name changing before the tracking code is processed (I hope so).

    The first object im my title explorer is a header script:

    <!– change title–>
    document.title = VarCurrentTitleName.getValue() + “: ” + VarCurrentPageName.getValue();
    <!– piwik tracking code –>
    … goes here …

    But: you have to have an action using CurrentPageName and CurrentTitelName prior this script, otherweise the variable will not be present for the header script (why?).

    Thanks for listening.

    • This reply was modified 5 years, 1 month ago by Profile photo of Reiner Fuest Reiner Fuest.
    • This reply was modified 5 years, 1 month ago by Profile photo of Reiner Fuest Reiner Fuest.
    • This reply was modified 5 years, 1 month ago by Profile photo of Reiner Fuest Reiner Fuest.
    • This reply was modified 5 years, 1 month ago by Profile photo of Reiner Fuest Reiner Fuest.
    #298701 Score: 2
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    339 pts
    @ssneg

    But: you have to have an action using CurrentPageName and CurrentTitelName prior this script, otherweise the variable will not be present for the header script (why?).

    Lectora only initiates variables that are used in the page for some reason. This is the case with using any variable and JavaScript in Lectora.

    There are a couple of ways to initialize the variable:
    1. use it in an action on the page. Even using it in a condition will do. So you can create a dummy action that does nothing on the title level and add ALL required variables to its condition.
    2. Set it as a “Required variable” for a HTML External Object. This is my preferred method. I use an HTML Ext Object set to Meta tags to include all my external scripts and CSS rules. It is located on the title level, so I also set all variables as Required for that object and then they’re initialized throughout the title.

    Once you know of that limitation, you just do it without thinking twice, so it isn’t a big nuisance. But I still reported this to Trivantis and asked them if this behaviour could be changed, especially that it isn’t the case in Lectora Online, where all variables are accessible at all times. Hopefully it’ll make it into one of the future releases.

    This post has received 2 votes up.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.