Microdata overhaul
authorMarcel Werk <burntime@woltlab.com>
Mon, 11 Jul 2016 14:41:13 +0000 (16:41 +0200)
committerMarcel Werk <burntime@woltlab.com>
Mon, 11 Jul 2016 14:41:13 +0000 (16:41 +0200)
com.woltlab.wcf/templates/article.tpl
com.woltlab.wcf/templates/breadcrumbs.tpl
com.woltlab.wcf/templates/commentList.tpl
com.woltlab.wcf/templates/commentResponseList.tpl
com.woltlab.wcf/templates/headInclude.tpl
com.woltlab.wcf/templates/header.tpl
com.woltlab.wcf/templates/messageSidebar.tpl
com.woltlab.wcf/templates/pageHeaderSearch.tpl
wcfsetup/install/files/acp/templates/header.tpl
wcfsetup/install/files/style/ui/breadcrumb.scss

index b46be86c81a25dc11046978ee963d516234243b8..e17a55b627cdcf0cbf4bc8008c36010ae280d339 100644 (file)
@@ -1,27 +1,35 @@
 {capture assign='pageTitle'}{$articleContent->title}{/capture}
 
+{assign var='__mainItemScope' value='itemprop="mainEntity" itemscope itemtype="http://schema.org/Article"'}
+
 {capture assign='contentHeader'}
        <header class="contentHeader articleContentHeader">
                <div class="contentHeaderTitle">
-                       <h1 class="contentTitle">{$articleContent->title}</h1>
+                       <h1 class="contentTitle" itemprop="name headline">{$articleContent->title}</h1>
                        <ul class="inlineList contentHeaderMetaData articleMetaData">
-                               <li>
+                               <li itemprop="author" itemscope itemtype="http://schema.org/Person">
                                        <span class="icon icon16 fa-user"></span>
                                        {if $article->userID}
-                                               <a href="{link controller='User' id=$article->userID title=$article->username}{/link}" class="userLink" data-user-id="{@$article->userID}">{$article->username}</a>
+                                               <a href="{link controller='User' id=$article->userID title=$article->username}{/link}" class="userLink" data-user-id="{@$article->userID}" itemprop="url">
+                                                       <span itemprop="name">{$article->username}</span>
+                                               </a>
                                        {else}
-                                               {$article->username}
+                                               <span itemprop="name">{$article->username}</span>
                                        {/if}
                                </li>
                                
                                <li>
                                        <span class="icon icon16 fa-clock-o"></span>
-                                       {@$article->time|time}
+                                       <span>{@$article->time|time}</span>
+                                       <meta itemprop="datePublished" content="{@$article->time|date:'c'}">
+                                       <meta itemprop="dateModified" content="{@$article->time|date:'c'}">
                                </li>
                                
-                               <li>
+                               <li itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter">
                                        <span class="icon icon16 fa-comments"></span>
-                                       {lang}wcf.article.articleComments{/lang}
+                                       <span>{lang}wcf.article.articleComments{/lang}</span>
+                                       <meta itemprop="interactionType" content="http://schema.org/CommentAction">
+                                       <meta itemprop="userInteractionCount" content="{@$article->comments}">
                                </li>
                                
                                <li>
                                
                                <li class="articleLikesBadge"></li>
                        </ul>
+                       
+                       <meta itemprop="mainEntityOfPage" content="{$canonicalURL}">
+                       <div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
+                               <meta itemprop="name" content="{PAGE_TITLE|language}">
+                               <div itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
+                                       <meta itemprop="url" content="{@$__wcf->getPath()}images/default-logo.png">{* @TODO *}
+                               </div>
+                       </div>
                </div>
                
                {hascontent}
                {/foreach}
        {/if}
        <link rel="amphtml" href="{link controller='ArticleAmp' object=$articleContent}{/link}">
-       
-       <script type="application/ld+json">
-               {
-                       "@context": "http://schema.org",
-                       "@type": "NewsArticle",
-                       "@id": "{$canonicalURL}",
-                       "headline": "{$articleContent->title}",
-                       "datePublished": "{@$article->time|plainTime}",
-                       "dateModified": "{@$article->time|plainTime}",
-                       "description": "{@$articleContent->getFormattedTeaser()}",
-                       "author": {
-                               "@type": "Person",
-                               "name": "{$article->username}"
-                       },
-                       "publisher": {
-                               "@type": "Organization",
-                               "name": "{PAGE_TITLE|language}",
-                               "logo": {
-                                       "@type": "ImageObject",
-                                       "url": "{@$__wcf->getPath()}images/default-logo.png",{* @TODO *}
-                                       "width": 288,
-                                       "height": 40
-                               }
-                       }
-                       {if $articleContent->getImage()}
-                       ,"image": {
-                               "@type": "ImageObject",
-                               "url": "{$articleContent->getImage()->getThumbnailLink('large')}",
-                               "width": {@$articleContent->getImage()->getThumbnailWidth('large')},
-                               "height": {@$articleContent->getImage()->getThumbnailHeight('large')}
-                       }
-                       {/if}
-               }
-       </script>
 {/capture}
 
 {include file='header'}
 
 {if $articleContent->getImage()}
        <section class="section">
-               <figure class="articleImage">
+               <figure class="articleImage" itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
                        <div class="articleImageWrapper">{@$articleContent->getImage()->getThumbnailTag('large')}</div>
                        {if $articleContent->getImage()->caption}
-                               <figcaption>{$articleContent->getImage()->caption}</figcaption>
+                               <figcaption itemprop="description">{$articleContent->getImage()->caption}</figcaption>
                        {/if}
+                       <meta itemprop="url" content="{$articleContent->getImage()->getThumbnailLink('large')}">
+                       <meta itemprop="width" content="{@$articleContent->getImage()->getThumbnailWidth('large')}">
+                       <meta itemprop="height" content="{@$articleContent->getImage()->getThumbnailHeight('large')}">
                </figure>
        </section>
 {/if}
index 519840fc6aa32561bb6fb1af8bc86387a4cefed7..bf5512a7eaf40eeefe438e4c7ebfc8218f73a08d 100644 (file)
@@ -1,16 +1,16 @@
 {if !$__microdata|isset}{assign var=__microdata value=true}{/if}
 {hascontent}
        <nav class="breadcrumbs">
-               <ul>
+               <ol{if $__microdata} itemprop="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"{/if}>
                        {content}
                                {foreach from=$__wcf->getBreadcrumbs() item=$breadcrumb}
-                                       <li title="{$breadcrumb->getLabel()}"{if $__microdata} itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"{/if}>
-                                               <a href="{$breadcrumb->getURL()}"{if $__microdata} itemprop="url"{/if}><span{if $__microdata} itemprop="title"{/if}>{$breadcrumb->getLabel()}</span></a>
+                                       <li title="{$breadcrumb->getLabel()}"{if $__microdata} itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"{/if}>
+                                               <a href="{$breadcrumb->getURL()}"{if $__microdata} itemprop="url"{/if}><span{if $__microdata} itemprop="name"{/if}>{$breadcrumb->getLabel()}</span></a>
                                        </li>
                                {/foreach}
                                
                                {event name='breadcrumbs'}
                        {/content}
-               </ul>
+               </ol>
        </nav>
 {/hascontent}
index a52cef6f3b73ef8a3aaee09a7fde9aa6dc18411f..35693c18b374d4cdf155a941fb24e4333d2dde89 100644 (file)
                                {@$comment->getUserProfile()->getAvatar()->getImageTag(48)}
                        {/if}
                        
-                       <div>
+                       <div itemprop="comment" itemscope itemtype="http://schema.org/Comment">
                                <div class="commentContent">
+                                       <meta itemprop="dateCreated" content="{@$comment->time|date:'c'}">
+                                       
                                        <div class="containerHeadline">
-                                               <h3>
+                                               <h3 itemprop="author" itemscope itemtype="http://schema.org/Person">
                                                        {if $comment->userID}
-                                                               <a href="{link controller='User' object=$comment->getUserProfile()}{/link}" class="userLink" data-user-id="{@$comment->userID}">{$comment->username}</a>
+                                                               <a href="{link controller='User' object=$comment->getUserProfile()}{/link}" class="userLink" data-user-id="{@$comment->userID}" itemprop="url">
+                                                                       <span itemprop="name">{$comment->username}</span>
+                                                               </a>
                                                        {else}
-                                                               {$comment->username}
+                                                       <span itemprop="name">{$comment->username}</span>
                                                        {/if}
                                                        
                                                        <small class="separatorLeft">{@$comment->time|time}</small>
                                                </h3>
                                        </div>
                                        
-                                       <div class="userMessage">{@$comment->getFormattedMessage()}</div>
+                                       <div class="userMessage" itemprop="text">{@$comment->getFormattedMessage()}</div>
                                        
                                        <nav class="jsMobileNavigation buttonGroupNavigation">
                                                <ul class="buttonList iconList">
index 39f9634953651f2e4959f71bfc15d7b077b59f18..16c8feaed54b1dbda5a71049652ced90688ed620 100644 (file)
@@ -9,20 +9,24 @@
                                {@$response->getUserProfile()->getAvatar()->getImageTag(32)}
                        {/if}
                        
-                       <div class="commentContent commentResponseContent">
+                       <div class="commentContent commentResponseContent" itemprop="comment" itemscope itemtype="http://schema.org/Comment">
+                               <meta itemprop="dateCreated" content="{@$response->time|date:'c'}">
+                               
                                <div class="containerHeadline">
-                                       <h3>
+                                       <h3 itemprop="author" itemscope itemtype="http://schema.org/Person">
                                                {if $response->userID}
-                                                       <a href="{link controller='User' object=$response->getUserProfile()}{/link}" class="userLink" data-user-id="{@$response->userID}">{$response->username}</a>
+                                                       <a href="{link controller='User' object=$response->getUserProfile()}{/link}" class="userLink" data-user-id="{@$response->userID}" itemprop="url">
+                                                               <span itemprop="name">{$response->username}</span>
+                                                       </a>
                                                {else}
-                                                       {$response->username}
+                                                       <span itemprop="name">{$response->username}</span>
                                                {/if}
                                                
                                                <small class="separatorLeft">{@$response->time|time}</small>
                                        </h3>
                                </div>
                                
-                               <div class="userMessage">{@$response->getFormattedMessage()}</div>
+                               <div class="userMessage" itemprop="text">{@$response->getFormattedMessage()}</div>
                                
                                <nav class="jsMobileNavigation buttonGroupNavigation">
                                        <ul class="buttonList iconList">
index c684a3545b3833858f048c784f04cf335915521a..3b7eb041f38c6d2cfae0ccf83e582d71719acaff 100644 (file)
@@ -1,4 +1,3 @@
-<base href="{$baseHref}">
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <meta name="format-detection" content="telephone=no">
index df66bc218296390be9793d66582ee36db8045eaa..dbe317854022753c7f191b3816090bc267e6d8f7 100644 (file)
@@ -21,7 +21,7 @@
        {/if}
 </head>
 
-<body id="tpl_{$templateNameApplication}_{$templateName}" data-template="{$templateName}" data-application="{$templateNameApplication}"{if $__wcf->getActivePage() != null} data-page-id="{@$__wcf->getActivePage()->pageID}" data-page-identifier="{$__wcf->getActivePage()->identifier}"{/if}>
+<body id="tpl_{$templateNameApplication}_{$templateName}" itemscope itemtype="http://schema.org/WebPage"{if !$canonicalURL|empty} itemid="{$canonicalURL}"{/if} data-template="{$templateName}" data-application="{$templateNameApplication}"{if $__wcf->getActivePage() != null} data-page-id="{@$__wcf->getActivePage()->pageID}" data-page-identifier="{$__wcf->getActivePage()->identifier}"{/if}>
 
 <a id="top"></a>
 
@@ -64,7 +64,7 @@
                </div>
        {/hascontent}
        
-       <section id="main" class="main" role="main">
+       <section id="main" class="main" role="main"{if !$__mainItemScope|empty} {@$__mainItemScope}{/if}>
                <div class="layoutBoundary">
                        {hascontent}
                                <aside class="sidebar boxesSidebarLeft">
index 162982c825a2313c3c41d8578ae7d02490d678ed..0a4385c20a7568b228658f5385298555995065f8 100644 (file)
@@ -1,8 +1,11 @@
+{if !$enableMicrodata|isset}
+       {assign var=enableMicrodata value=false}
+{/if}
 {if !$__messageSidebarJavascript|isset}
        {assign var=__messageSidebarJavascript value=true}
 {/if}
 
-<aside class="messageSidebar{if MESSAGE_SIDEBAR_ENABLE_ONLINE_STATUS && $userProfile->isOnline()} userOnline{/if} {if $userProfile->userID}member{else}guest{/if}">
+<aside class="messageSidebar{if MESSAGE_SIDEBAR_ENABLE_ONLINE_STATUS && $userProfile->isOnline()} userOnline{/if} {if $userProfile->userID}member{else}guest{/if}"{if $enableMicrodata} itemprop="author" itemscope itemtype="http://schema.org/Person"{/if}>
        <div class="messageAuthor">
                {event name='messageAuthor'}
                
@@ -18,8 +21,8 @@
                        {/if}
                        
                        <div class="messageAuthorContainer">
-                               <a href="{link controller='User' object=$userProfile->getDecoratedObject()}{/link}" class="username userLink" data-user-id="{@$userProfile->userID}">
-                                       <span>{if MESSAGE_SIDEBAR_ENABLE_USER_ONLINE_MARKING}{@$userProfile->getFormattedUsername()}{else}{$username}{/if}</span>
+                               <a href="{link controller='User' object=$userProfile->getDecoratedObject()}{/link}" class="username userLink" data-user-id="{@$userProfile->userID}"{if $enableMicrodata} itemprop="url"{/if}>
+                                       <span{if $enableMicrodata} itemprop="name"{/if}>{if MESSAGE_SIDEBAR_ENABLE_USER_ONLINE_MARKING}{@$userProfile->getFormattedUsername()}{else}{$username}{/if}</span>
                                </a>
                                {if $userProfile->banned}<span class="icon icon16 fa-lock jsTooltip jsUserBanned" title="{lang user=$userProfile}wcf.user.banned{/lang}"></span>{/if}
                                
@@ -38,7 +41,7 @@
                        {/if}
                {else}
                        <div class="messageAuthorContainer">
-                               <span class="username">{$userProfile->username}</span>
+                               <span class="username"{if $enableMicrodata} itemprop="name"{/if}>{$userProfile->username}</span>
                                
                                {event name='messageAuthorContainer'}
                        </div>
index e3ca796d6a3f68e968027fe8eab6d44b6f5bdd37..1eccf74a445b6ffefabfb054af93c9214e82da46 100644 (file)
 
 {event name='settings'}
 
-<div id="pageHeaderSearch" class="pageHeaderSearch">
-       <form method="post" action="{@$__searchLink}">
+<div id="pageHeaderSearch" class="pageHeaderSearch" itemscope itemtype="http://schema.org/WebSite" itemid="{link appendSession=false}{/link}">
+       <meta itemprop="url" content="{link appendSession=false}{/link}">
+       <meta itemprop="name" content="{PAGE_TITLE|language}">
+       <meta itemprop="description" content="{PAGE_DESCRIPTION|language}">
+       
+       <form method="post" action="{@$__searchLink}" itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
+               <meta itemprop="target" content="{link controller='Search' appendSession=false}q={/link}{literal}{q}{/literal}">
+               
                <div id="pageHeaderSearchInputContainer" class="pageHeaderSearchInputContainer">
                        <div class="pageHeaderSearchType dropdown">
                                <a href="#" class="button dropdownToggle">{@$__searchTypeLabel}</a>
@@ -48,7 +54,7 @@
                                </ul>
                        </div>
                        
-                       <input type="search" name="q" id="pageHeaderSearchInput" class="pageHeaderSearchInput" placeholder="{lang}wcf.global.search.enterSearchTerm{/lang}" autocomplete="off" value="{if $query|isset}{$query}{/if}" required>
+                       <input itemprop="query-input" type="search" name="q" id="pageHeaderSearchInput" class="pageHeaderSearchInput" placeholder="{lang}wcf.global.search.enterSearchTerm{/lang}" autocomplete="off" value="{if $query|isset}{$query}{/if}" required>
                        
                        <button class="pageHeaderSearchInputButton button" type="submit">
                                <span class="icon icon16 fa-search pointer" title="{lang}wcf.global.search{/lang}"></span>
index 9c1f60367910e51a5472f93cdb428c08e708d0a3..ad988439b32f71b9b670800f1751a8e2683d2ab2 100644 (file)
@@ -1,7 +1,6 @@
 <!DOCTYPE html>
 <html dir="{@$__wcf->getLanguage()->getPageDirection()}" lang="{@$__wcf->getLanguage()->getFixedLanguageCode()}">
 <head>
-       <base href="{$baseHref}">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="robots" content="noindex">
index 3f82f8a632d3cf544aff8253894bd72b6ae9c499..3f74e570b1d0c1ef6f6a7c4f26cce24c483f82e3 100644 (file)
@@ -1,7 +1,7 @@
 .breadcrumbs {
        flex: 1;
        
-       > ul {
+       > ol {
                display: flex;
                
                > li {