简体   繁体   English

TYPO3:元标记作者,如何同时使用名称和电子邮件

[英]TYPO3: meta tag author, how to use both name and email

the html5 standard accepts the author tag as name and email: html5标准接受author标签作为名称和电子邮件:

<meta name="author" content="name, email@hotmail.com">

The TYPO3 backend allows you to register them both in the Page properties as "Author Name" (field: author ) and "Author Email" (field: author_email ), TYPO3后端允许您在Page属性中将它们注册为“作者名称”(字段: author )和“作者电子邮件”(字段: author_email ),

I know how to include the tag (I use the value recursive): 我知道如何包含标记(我使用递归值):

page = PAGE
page {
    meta {
        author.data = levelfield :-1, author slide
        author.override.field = author
    }
}

how do I add the email correctly with typoscript ? 我该如何正确添加带有拼写错误的电子邮件?

You probably can use a cObject which concatenates both fields within a COA. 您可能可以使用将COA中的两个字段连接起来的cObject

page.meta.author.cObject = COA
page.meta.author.cObject {
    10 = TEXT
    10.data = levelfield :-1, author slide
    10.noTrimWrap = ||, |

    20 = TEXT
    20.data = levelfield :-1, author_email slide
    20.noTrimWrap = ||, |

    stdWrap.subString = 0,-2
}

As not all fields are ready to slide you need to declare these additional fields for sliding. 由于并非所有字段都准备好滑动,因此您需要声明这些其他字段以进行滑动。 This can be done in the install tool or an extension. 这可以在安装工具或扩展程序中完成。
Solution for an extension: insert in your ext_localconf.php : 扩展解决方案:在您的ext_localconf.php插入:

$rootlinefields = &$GLOBALS["TYPO3_CONF_VARS"]["FE"]["addRootLineFields"]; 
if ($rootlinefields != '') { 
    $rootlinefields .= ' , '; 
} 
$rootlinefields .= 'author,author_email';

Attention: 注意:
As author and author_email slide independently you might get a mixed content from different pages authorauthor_email独立滑动时,您可能会从不同页面获得混合内容

Inspired by Bernd I have something half working: 受Bernd的启发,我的工作有些成功:

page {
    meta {
        author.cObject = COA
        author.cObject {
            10 = TEXT
            10 {
                data = levelfield :-1, author, slide
                override.field = author
                wrap = |
            }

            20 = TEXT
            20 {
                field = author_email
                noTrimWrap = |, ||
                if {
                    isTrue.field = author_email
                    isTrue = 1
                    isTrue.if {
                        isTrue.field = author
                    }
                }
            }
        }
    }
}

like this an author will slide, but an email will only be added if there is the combination author and email on the page ... 像这样的作者将滑动,但仅当页面上同时存在作者和电子邮件的组合时,才会添加电子邮件...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM