How can I insert the current page title automatically into a TYPO3 template?

lib.pagetitle = RECORDS
lib.pagetitle {
    source.data = page:uid
    tables = pages
    conf.pages = TEXT
    conf.pages.field = nav_title
}

To get current page title:

lib.pagetitle = TEXT
lib.pagetitle.field=title

For meta data :

Its very important to place meta after header tag when we are gone through mobile compatible website

In order to prevent quirks mode in IE9 I need to add this lines at the very top of every HTML page:

You can write the whole header by yourself, by adding disableAllHeaderCode = 1 to your typoscript or you can hack it by adding your meta tag directly to the head tag:

 page.headTag = <head><meta http-equiv="X-UA-Compatible" content="IE=edge" />

Place this at your typoscript

 meta.X-UA-Compatible = IE=edge,chrome=1

httpEquivalent: (Since TYPO3 4.7) If set to 1, the http-equiv attribute is used in the meta tag instead of the “name” attribute. Default: 0.

For more information about TYPO3 stuff you may visit my blog

https://jainishsenjaliya.wordpress.com/2013/10/10/put-meta-tag-on-top-of-header-section-in-typo3/


I prefer the vhs solution:

{v:page.info(field:'title')}

https://fluidtypo3.org/viewhelpers/vhs/master/Page/InfoViewHelper.html


It is. It's pretty simple to do. I'll assume you're using TemplaVoilà, because if you're not, you should be :-D

Start off by putting some HTML in your template with a dummy page title. Give it an ID attribute so it's easy to map. Like:

<h1 id="page-title">Page Title Here</h1>

Next, go into TemplaVoilà and map that <h1> element to the content type "TypoScript Object Path". When it prompts you for the object path, you can put in anything you want -- convention is that dynamic content is added in the "lib" namespace, so let's call it lib.pagetitle. When it asks you if you want to map this to "INNER" or "OUTER", choose "INNER" -- that will mean you're just mapping the space BETWEEN the <h1>...</h1> tags. ("OUTER" means you're replacing the whole element, including the tags, which we don't want here because we want this to stay an H1.) Save your template mapping.

Now go into your site's TypoScript template. Here you're going to insert the logic that fills in that space we just mapped with actual content. To insert the page title is a matter of a couple of lines of TypoScript:

lib.pagetitle = TEXT
lib.pagetitle.data = page : title

What this says is "take the space in the template that I mapped to lib.pagetitle. Create a content object in that space of type TEXT. Then fill that content object with the title of the page."

Save your TypoScript template. Now you're done!

This probably sounds complicated at first glance, and it is, but the nice thing about this system is that it's amazingly flexible. Inserting text dynamically is just the beginning. The TypoScript Reference (a.k.a. the "TSRef") has all the details -- look up "getText" to get a flavor, that's the function that makes the "page : title" call in your TypoScript template drop in the page title.

TSRef is your friend. I keep a printed copy of it at my desk -- if you want to make TYPO3 sing, it is your songbook.