Bug #86956

Typoscript meta tag field settings have no effect

Added by Christoph Sölder 10 months ago. Updated 3 months ago.

Status:
Needs Feedback
Priority:
Must have
Assignee:
-
Category:
SEO
Target version:
-
Start date:
2018-11-20
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When defining meta tags with typoscript for example

page {
    meta {
        author = {$page.meta.author}
        author {
             override.field = author
        }
    }
}

the override value is not rendered in the frontend if it is set in the backend.
The frontend alway shows the value set in {$page.meta.author}.

Similar if you define a meta tag that takes it's value directly from a database field e.g.

page {
    meta {
        author.field = author
    }
}

The tag is not rendered in the frontend.

Using `page.meta.author.replace=1` doesn't help either.

The only way i got the override to work is the following:

page.meta.author.override.field >
page.meta.author.override.data = DB:pages:{TSFE:id}:author
page.meta.author.override.data.insertData = 1

To me it seems like the parameter "field" isn't working as expected.

History

#1 Updated by Richard Haeser 10 months ago

  • Status changed from New to Accepted

I can confirm this issue

#2 Updated by Vasyl Mosiychuk 10 months ago

I can confirm this issue too...

My TYPO3 9.5.1, PHP 7.2

page {
    meta {
        author = {$page.meta.author}
        author {
             override.field = author
        }
        keywords = {$page.meta.keywords}
        keywords {
             override.field = keywords
        }
    }
}

...and it is not working

page {
    meta {
        author.data = author
        keywords.data = keywords
    }
}
page {
    meta {
        author.data = levelfield:-1, author, slide
        keywords.data = levelfield:-1, keywords, slide
    }
}

...very strange but it is working

page {
    meta {
        description = {$page.meta.description}
        description {
             override.field = description
        }
    }
}

...and it is working

page {
    meta {
        keywords.data = page:keywords
        author.data = page:author
    }
}

#3 Updated by Vasyl Mosiychuk 10 months ago

Tested on the TYPO3 v. 9.5.1 with Bootstrap Package 10.0.4 - working

page {
    meta {
        keywords = {$page.meta.keywords}
        keywords {
            stdWrap {
                override {
                    data = page:keywords
                }
            }
        }
        author = {$page.meta.author}
        author {
            stdWrap {
                override {
                    data = page:author
                }
            }
        }
    }
}

#4 Updated by Riccardo De Contardi 10 months ago

These are my findings with TYPO3 9.5.2 (latest master)
- I created three constants
- on one page, I set the values of the fields author, keyword, description

These three lines are always present on each test

page.meta.author = {$page.meta.author} >>> constant is shown
page.meta.keywords = {$page.meta.keywords} >>> constant is shown
page.meta.description = {$page.meta.description} >>> Note: in this situation the description field of the page properties will be taken; if not empty!

For each test, I added the following three lines (each time a different set of lines)

Test 1 - added:

page.meta.author.override.field = author >>> Does not work; the constant is shown
page.meta.keywords.override.field = keywords >>> Does not work; the constant is shown
page.meta.description.override.field = description >>>Works the field value is taken; but see the previous Note!

Test 2 - added:

@page.meta.author.data = author >>> Does not work; the tag is missing
@page.meta.keywords.data = keywords >>> Does not work; the tag is missing
@page.meta.description.data = description >>> Works, but see the previous Note!

Test 4 - added:

page.meta.author.data = page:author >>> Works the field value is taken; the tag is missing if empty
page.meta.keywords.data = page:keywords >>> Works the field value is taken; the tag is missing if empty
page.meta.description.data = page:description >>> Works the field value is taken; the tag is missing if empty

Test 5 - added:

page.meta.author.data = levelfield:-1, author, slide >>> Works the field value is taken; also the slide works
page.meta.keywords.data = levelfield:-1, keywords, slide >>> Works the field value is taken; also the slide works
page.meta.description.data = levelfield:-1, description, slide >>> Works the field value is taken; also the slide works

NOTE 2: in Install Tool, set ['FE']['addRootLineFields'] => 'author,description,keywords'

Test 6 - added:

page.meta.author.override.data = page:author >>> Works the field value is taken; constant is shown if empty
page.meta.keywords.override.data = page:keywords >>> Works the field value is taken; constant is shown if empty
page.meta.description.override.data = page:description >>> Works the field value is taken; constant is shown if empty

Test 7 - added:

page.meta.author.stdWrap.override.data = page:author >>> Works the field value is taken; constant is shown if empty
page.meta.keywords.stdWrap.override.data = page:keywords >>> Works the field value is taken; constant is shown if empty
page.meta.description.stdWrap.override.data = page:description >>> Works the field value is taken; constant is shown if empty

#5 Updated by Richard Haeser 8 months ago

  • Status changed from Accepted to Needs Feedback

Can you check again? Can't reproduce anymore. (Also not on 9.5.1...)

#6 Updated by Riccardo De Contardi 8 months ago

@Richard Haeser I repeated the same tests with 9.5.4 and had slightly different results:

Test 1 -> same results
Test 2 -> one different result:
page.meta.description.data = description >>> Value from field is taken if not empty; Tag is missing if empty
Test 4 -> same results
Test 5 -> all different results:
page.meta.author.data = levelfield:-1, author, slide >>> Does not work; the tag is missing; also the slide works
page.meta.keywords.data = levelfield:-1, keywords, slide >>> Does not work; the tag is missing; also the slide works
page.meta.description.data = levelfield:-1, description, slide >>> Value from field is taken if not empty; Tag is missing if empty; also the slide works
Test 6 -> same results
Test 7 -> same results

I cleared the frontend cache before each test.

#7 Updated by Benjamin Eyring 6 months ago

This issue still seems active in 9.5.5

As a workaround we solved it like this:

1. Deactivate rendering of the seo tags:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags'] = NULL;

2. Set the fields to slide=true:
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] = 'og_title,og_description,og_image,twitter_title,twitter_description,twitter_image,author,author_email';

3. Manually manage seo tags using TS:

70 = COA
70 { # OG:TITLE ###########################################
10 = TEXT
10 {
data = levelfield:-1, og_title, slide
noTrimWrap = |<meta property="og:title" content="|" />|
} # OG:TYPE ###########################################
20 = TEXT
20 {
value = website
noTrimWrap = |<meta property="og:type" content="|" />|
} # OG:URL #############################################
30 = TEXT
30 {
typolink {
parameter.data = tsfe:id
parameter.insertData = 1
useCacheHash = 1
addQueryString = 1
addQueryString.method = get
addQueryString.exclude = id
forceAbsoluteUrl = 1
returnLast = url
}
wrap = <meta property="og:url" content="|">
} # OG:DESCRIPTION ######################################
40 = TEXT
40 {
data = levelfield:-1, og_description, slide
stdWrap.wrap = <meta property="og:description" content="|" />
} # OG:IMAGE ############################################ # Adaption for news see below
50 = FILES
50 {
references {
data = levelfield:-1, og_image, slide
}
renderObj = IMG_RESOURCE
renderObj {
file.import.data = file:current:publicUrl
}
stdWrap.dataWrap = <meta property="og:image" content="{site:base}|" />
required = 1
}
}

TBD: Check, if these tags are set correctly for news detail pages.

Don't know if there is a better solution?

#8 Updated by Riccardo De Contardi 3 months ago

I repeated my tests (see comment 4) on 9.5.8 with a more rich scenario:

- I created three constants:

page.meta.author = AUTORE DA COSTANTE
page.meta.keywords = KEYWORD DA COSTANTE
page.meta.description = DESCRIPTION DA COSTANTE

- I created four pages

Page A
Author field: filled with AUTORE DA PAGINA
Keyword field: filled with KEYWORD DA PAGINA
Description field: filled with DESCRIPTION DA PAGINA

Page B
Author field: empty
Keyword field: empty
Description field: filled with DESCRIPTION DA PAGINA

Page C
Author field: filled with AUTORE DA PAGINA
Keyword field: filled with KEYWORD DA PAGINA
Description field: empty

Page D
Author field: empty
Keyword field: empty
Description field: empty

So to sum up

Page A Page B Page C Page D
Author filled [empty] filled [empty]
Kewyord filled [empty] filled [empty]
Description filled filled [empty] [empty]

Note: for test 5 that involves the "slide" I created a subpage for each page; the fields on all the subpages are always empty;

on Install Tool I set ['FE']['addRootLineFields'] => 'author,description,keywords'

- for each test, the lines:

page.meta.author = {$page.meta.author} 
page.meta.keywords = {$page.meta.keywords} 
page.meta.description = {$page.meta.description}

are always present

- before each test, I cleared the cache

I sum up in the following table the results of all the tests;

legend:

for each cell of the table, I report the values taken for Author, Keywords and Description in this order;

"C" means that the value from the constants is taken; "P" means that the value from the page field is taken; "/" means that the tag is absent

Test Page A Page B Page C Page D
only
page.meta.author = {$page.meta.author} 
page.meta.keywords = {$page.meta.keywords} 
page.meta.description = {$page.meta.description}
C C P C C P C C C C C C
Added:
page.meta.author.override.field = author 
page.meta.keywords.override.field = keywords
page.meta.description.override.field = description
P P P C C P P P C C C C
Added:
page.meta.author.data = author
page.meta.keywords.data = keywords
page.meta.description.data = description
/ / P / / P / / / / / /
Added:
page.meta.author.data = page:author 
page.meta.keywords.data = page:keywords 
page.meta.description.data = page:description
P P P / / P P P / / / /
Added:
page.meta.author.data = levelfield:-1, author, slide 
page.meta.keywords.data = levelfield:-1, keywords, slide
page.meta.description.data = levelfield:-1, description, slide 
P P P / / P P P / / / /
same configuration of the previous line; checked the subpage of each page P P P / / P P P / / / /
Added:
page.meta.author.override.data = page:author 
page.meta.keywords.override.data = page:keywords
page.meta.description.override.data = page:description 
P P P C C P P P C C C C
Added:
page.meta.author.stdWrap.override.data = page:author 
page.meta.keywords.stdWrap.override.data = page:keywords 
page.meta.description.stdWrap.override.data = page:description 
P P P C C P P P C C C C

From a first glance, the test with

page.meta.author.data = author
page.meta.keywords.data = keywords
page.meta.description.data = description

seems to present the most faulty behavior;

Also available in: Atom PDF