Manipulate / Change site title with tx_metaseo - typo3

I'm not able to change the title of the browser. That's how I render the title:
page.headerData.5 = TEXT
page.headerData.5.field = subtitle // title
page.headerData.5.wrap = <title>| | IrgendEinName</title>
... which works. In addition I use tx_metaseo, which also works. If I now want to manually change a site title in Properties->SEO and then under ...
title-TAG (absolute, without prefix/suffix)
... I can't change the title.
My solution now:
[globalVar = TSFE:id = 24]
page.headerData.5 = TEXT
page.headerData.5.field = tx_metaseo_pagetitle
page.headerData.5.wrap = <title>| | IrgendEinName</title>
[end]
[globalVar = TSFE:id != 24]
page.headerData.5 = TEXT
page.headerData.5.field = subtitle // title
page.headerData.5.wrap = <title>| | IrgendEinName</title>
[end]
Obviously for one site it's fine. But are there any other options? E.g. with .if.isNull. or .if.isFalse. where I say 'IF tx_metaseo_pagetitle IS EMPTY SELECT title ?
https://docs.typo3.org/typo3cms/TyposcriptReference/7.6/Functions/If/

if.notEmpty should work but I can't test it now. Quickly I found this solution:
[globalVar = TSFE:page|tx_metaseo_pagetitle=]
[else]
page.headerData.5 >
page.headerData.5 = TEXT
page.headerData.5 {
wrap = <title>|</title>
field = tx_metaseo_pagetitle
}
[global]

Related

TYPO3 8.7 - Link Target ist missing in navigation for page typ external URL

After update from TYPO3 7.6.16 to 8.7 in my navigation (TMENU) the target _blank is no longer output for pages of typ external URL. In page properties the target flag _blank is entered. Any hints?
Try this, working for me:
lib.mainmenuu = HMENU
lib.mainmenuu {
special = directory
special.value = 1
1=TMENU
1.wrap=<ul>|</ul>
1.NO {
# do not create a link here else there are double <a> tags
doNotLinkIt = 1
wrapItemAndSub=<li>|</li>
stdWrap.cObject = CASE
stdWrap.cObject {
key.field = doktype
default = TEXT
default {
field = title
typolink.parameter.field = uid
stdWrap.htmlSpecialChars = 1
}
# 3 = external url
3 = TEXT
3 {
field = title
typolink.parameter.field = url
typolink.extTarget = _blank
}
}
}
}
Here, use your news detail page id instead of 27. this will override default page title with current detail news title.

tx_news with pw_comment plugin typo3

I need to build a news detail page with comment option. When go to the detail page there must be an option for comment. So I configure pw_comment plugin. It's working fine. But all comments shows with every news. How can I show only comments with associated news? Please help me
My typoscript settings is
plugin.tx_pwcomments {
settings {
useEntryUid = 1
entryUid = TEXT
moderateNewComments = 0
secondsBetweenTwoComments = 60
entryUid.data = GP:tx_news|uid
replaceUsernameWith = COA_INT
replaceUsernameWith {
10 = TEXT
10.data = LLL:EXT:pw_comments/Resources/Private/Language/locallang.xml:tx_pwcomments.newComment.loggedInAs
20 = TEXT
20.data = TSFE:fe_user|user|username
20.noTrimWrap = | <b>|</b>|
stdWrap.wrap = <div class="loggedInAs">|</div>
}
replaceMailWith = TEXT
replaceMailWith.stdWrap.char = 0
}
}
config.contentObjectExceptionHandler = 0
My template includes the following coe
<f:if condition="{settings.templateLayout} == 'NewsCommentLayout' ">
<f:then>
<f:cObject typoscriptObjectPath="lib.pwCommentsIndex" />
<f:cObject typoscriptObjectPath="lib.pwCommentsNew"/>
</f:then>
</f:if>
I got the solution for my problem.I edited the typoscript.
plugin.tx_pwcomments {
settings {
moderateNewComments = 0
secondsBetweenTwoComments = 60
enableCommentVotes = 0
enableVoting = 0
hideVoteButtons = 1
replaceUsernameWith = COA_INT
replaceUsernameWith {
10 = TEXT
10.data = LLL:EXT:pw_comments/Resources/Private/Language/locallang.xml:tx_pwcomments.newComment.loggedInAs
20 = TEXT
20.data = TSFE:fe_user|user|username
20.noTrimWrap = | <b>|</b>|
stdWrap.wrap = <div class="loggedInAs">|</div>
}
replaceMailWith = TEXT
replaceMailWith.stdWrap.char = 0
}
}
config.contentObjectExceptionHandler = 0
[globalVar = GP:tx_news_pi1|news > 0]
plugin.tx_pwcomments.settings {
useEntryUid = 1
entryUid = TEXT
entryUid.data = GP:tx_news_pi1|news
}
[global]
You need to have a condition somewhere to show only related comments per news not to all news systems.
Best would be do show them with TypoScript and then make a condition for certain news not to show up.

Typo3 Adding a class to the body tag on a specifc page

I'm trying to figure out how conditionally add a class to the body tag of a specific page. I'm trying to do it via typoscipt but haven't been able to figure it out. Maybe there's a better way to do it though. The site is using Typo3 version 4.4.6
I've tried this which didn't work
page.4.bodyTag >
page.4.bodyTagCObject = TEXT
page.4.bodyTagCObject {
field = uid
wrap = <body class="uid-|">
}
Any help or pointers would be greatly appreciated!
Figured it out!
[globalVar = TSFE:id = 4]
page.bodyTag = <body class="page-speakers">
[end]
We use the follwing snippet for TYPO3 4.5 and TYPO3 6.2. Outputs class and id like this on every page. Just style your css.
<body id="pid13" class="be- rpid13 level1 no-subs">
Snippet to place into root setup:
page {
bodyTagCObject >
bodyTagCObject = COA
bodyTagCObject {
### id of page in root level:
10 = TEXT
10.data = levelfield:1, uid
10.dataWrap = id="pid{TSFE:id}" class="be-{TSFE:beUserLogin} rpid|
### current level/depth of page
20 = TEXT
20.data = level:1
20.noTrimWrap = | level| |
### if page has subpages
30 = TEXT
30.value = has-subs
30.if.isTrue.numRows {
table = pages
where = pid=this
}
### if page has NO subpages
40 = TEXT
40.value = no-subs
40.if.negate = 1
40.if.isTrue.numRows {
table = pages
where = pid=this
}
50 = TEXT
50.value = "
stdWrap.noTrimWrap = |<body |>|
}
}
Since TYPO3 Version 9:
# Body Classes
[page["uid"] == 1]
page.bodyTag = <body class="home">
[END]
Following will do
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.value= skin-blue
page.bodyTagCObject.wrap = <body class="|">

Canonical tag for tt_news should pointing from couple domain to only one

I'm usign tt_news for publishing news on sites. I have 3 domains which are using the same news content, and I would like to generate a canonical tags for news which will point to only one (main) domain. I have the following TypoScript, but it generates canonical tags with three different urls.
[globalVar = GP:tx_ttnews|tt_news > 0]
page.headerData.1422 = TEXT
page.headerData.1422 {
typolink.parameter.data = TSFE:id
typolink.forceAbsoluteUrl = 1
typolink.returnLast = url
typolink.additionalParams.cObject = COA
typolink.additionalParams.cObject {
10 = TEXT
10.dataWrap = &tx_ttnews[tt_news]={GP:tx_ttnews|tt_news}
10.if.isTrue.data = GP:tx_ttnews|tt_news
20 = TEXT
20.dataWrap = &tx_ttnews[cat]={GP:tx_ttnews|cat}
20.if.isTrue.data = GP:tx_ttnews|cat
}
wrap = <link href="|" rel="canonical">
}
[END]
Any sugestions?
i would just remove "forceAbsoluteURL" and add the baseUrl in your wrap on your own.
[globalVar = GP:tx_ttnews|tt_news > 0]
page.headerData.1422 = TEXT
page.headerData.1422 {
typolink.parameter.data = TSFE:id
# typolink.forceAbsoluteUrl = 1
typolink.returnLast = url
typolink.additionalParams.cObject = COA
typolink.additionalParams.cObject {
10 = TEXT
10.dataWrap = &tx_ttnews[tt_news]={GP:tx_ttnews|tt_news}
10.if.isTrue.data = GP:tx_ttnews|tt_news
20 = TEXT
20.dataWrap = &tx_ttnews[cat]={GP:tx_ttnews|cat}
20.if.isTrue.data = GP:tx_ttnews|cat
}
wrap = <link href="http://example.com/|" rel="canonical">
}
[END]

HMENU with graphics

In a TYPO3 site, I have a list of sibling pages. Each page has some images in the "media" field. Im trying to make a navigation to go to the previos/next sibling. So far I have this:
# Append Sitenavi for projects
[PIDupinRootline = 43]
page.10.marks.MAIN.20 = HMENU
page.10.marks.MAIN.20{
special = browse
special{
items = next|prev
}
1 = TMENU
1{
NO = 1
}
}
[global]
But instead of using the page title, id like to use the first image from the "files" field. How could I do it?
This is the way to get other fields:
page.10.marks.MAIN.20 = HMENU
page.10.marks.MAIN.20 {
special = browse
special {
items = prev | next
}
1 = TMENU
1 {
NO = 1
NO.stdWrap.field = subtitle // title
}
}
Now if your change subtitle // title to image and add NO.stdWrap.wrap = <img src"|" />, then it should work.