Skip to content

Commit

Permalink
[FIX] News title with seo_basic (#39)
Browse files Browse the repository at this point in the history
* [FIX] fixed title tag for categories and tags pages, also for news detail view. Added news to breadcrumbs.

* [FIX] removed using of custom title viewhelper
  • Loading branch information
anjeylink authored and dmh committed Jul 1, 2016
1 parent fb6ad8f commit 7ffe0d9
Show file tree
Hide file tree
Showing 7 changed files with 463 additions and 271 deletions.
127 changes: 127 additions & 0 deletions Configuration/TypoScript/Library/lib.menu.breadcrumb.setupts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,130 @@ lib.menu.breadcrumb {
}
}
}
[globalVar = GP:tx_news_pi1|news > 0] || [globalVar = GP:tx_news_pi1|overwriteDemand|categories > 0] || [globalVar = GP:tx_news_pi1|overwriteDemand|tags > 0]
lib.menu.breadcrumb {
10 {
1 {
NO {
doNotLinkIt = 0
linkWrap = <li class="breadcrumbs__list-item"><span class="icons icon-t3-home"></span>|</li> |*| <li class="breadcrumbs__list-item">|</li>
}
# append with news title
stdWrap {
append = COA
append {
20 = RECORDS
20 {
dontCheckPid = 1
source.intval = 1
stdWrap {
wrap = <li class="breadcrumbs__list-item _active">|</li>
required = 1
}
}
}
}
}
}
}
[globalVar = GP:tx_news_pi1|news > 0]
lib.menu.breadcrumb {
10 {
1 {
stdWrap {
append {
20 {
stdWrap.if.isTrue.data = GP:tx_news_pi1|news
tables = tx_news_domain_model_news
source.data = GP:tx_news_pi1|news
conf {
tx_news_domain_model_news = TEXT
tx_news_domain_model_news {
field = title
htmlSpecialChars = 1
}
}
}
}
}
}
}
}
[globalVar = GP:tx_news_pi1|overwriteDemand|categories > 0]
lib.menu.breadcrumb {
10 {
1 {
stdWrap {
append {
20 {
stdWrap.if.isTrue.data = GP:tx_news_pi1|overwriteDemand|categories
tables = sys_category
source.data = GP:tx_news_pi1|overwriteDemand|categories
conf {
sys_category = TEXT
sys_category {
field = title
htmlSpecialChars = 1
}
}
}
}
}
}
}
}
[globalVar = GP:tx_news_pi1|overwriteDemand|tags > 0]
lib.menu.breadcrumb {
10 {
1 {
stdWrap {
append {
20 {
stdWrap.if.isTrue.data = GP:tx_news_pi1|overwriteDemand|tags
tables = tx_news_domain_model_tag
source.data = GP:tx_news_pi1|overwriteDemand|tags
conf {
tx_news_domain_model_tag = TEXT
tx_news_domain_model_tag {
field = title
htmlSpecialChars = 1
}
}
}
}
}
}
}
}
[globalVar = GP:tx_news_pi1|overwriteDemand|year > 0] && [globalVar = GP:tx_news_pi1|overwriteDemand|month > 0]
lib.menu.breadcrumb {
10 {
1 {
NO {
doNotLinkIt = 0
linkWrap = <li class="breadcrumbs__list-item"><span class="icons icon-t3-home"></span>|</li> |*| <li class="breadcrumbs__list-item">|</li>
}
# append with news title
stdWrap {
append = COA
append {
20 = TEXT
20 {
dataWrap {
data = GP:tx_news_pi1|overwriteDemand|month
wrap = {LLL:EXT:news/Resources/Private/Language/locallang.xlf:month.|}
}
}
30 = TEXT
30 {
data = GP:tx_news_pi1|overwriteDemand|year
noTrimWrap = | ||
}

wrap = <li class="breadcrumbs__list-item _active">|</li>
}
}
}
}
}
[global]
7 changes: 7 additions & 0 deletions Configuration/TypoScript/Library/lib.pageTitle.setupts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
lib.pageTitle = TEXT

[userFunc = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('seo_basics')]
lib.pageTitle.data = page:tx_seo_titletag // page:title
[else]
lib.pageTitle.data = page:title
[global]
94 changes: 53 additions & 41 deletions Resources/Private/Extensions/News/Templates/Category/List.html
Original file line number Diff line number Diff line change
@@ -1,46 +1,58 @@
{namespace n=GeorgRinger\News\ViewHelpers}
<f:layout name="General" />
<!--
=====================
Templates/Category/List.html
-->
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers">

<f:section name="content">
<f:if condition="{categories}">
<f:then>
<f:layout name="General" />
<!--
=====================
Templates/Category/List.html
-->

<f:section name="content">
<f:if condition="{categories}">
<f:then>
<f:render section="categoryTree" arguments="{categories:categories,overwriteDemand:overwriteDemand}" />
</f:then>
<f:else>
<f:translate key="list_nocategoriesfound" />
</f:else>
</f:if>
</f:section>

<f:render section="categoryTree" arguments="{categories:categories,overwriteDemand:overwriteDemand}" />
</f:then>
<f:else>
<f:translate key="list_nocategoriesfound" />
</f:else>
</f:if>
</f:section>
<f:section name="categoryTree">
<div class="news-categories" >
<ul>
<f:for each="{categories}" as="category">
<li>
<f:if condition="{category.item.uid} == {overwriteDemand.categories}">
<f:then>
<f:comment>
Set title tag for active category
</f:comment>
<n:format.nothing>
<n:titleTag>
<n:format.htmlentitiesDecode><f:cObject typoscriptObjectPath="lib.pageTitle"/> - {category.item.title}</n:format.htmlentitiesDecode>
</n:titleTag>
</n:format.nothing>

<f:section name="categoryTree">
<div class="news-categories" >
<ul>
<f:for each="{categories}" as="category">
<li>
<f:if condition="{category.item.uid} == {overwriteDemand.categories}">
<f:then>
<f:link.page title="{category.item.title}" class="active" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:then>
<f:else>
<f:link.page title="{category.item.title}" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:else>
</f:if>
<f:link.page title="{category.item.title}" class="active" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:then>
<f:else>
<f:link.page title="{category.item.title}" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:else>
</f:if>

<f:if condition="{category.children}">
<f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand}" />
</f:if>
</li>
</f:for>
</ul>
</div>
</f:section>
</div>

<f:if condition="{category.children}">
<f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand}" />
</f:if>
</li>
</f:for>
</ul>
</div>
</f:section>
84 changes: 52 additions & 32 deletions Resources/Private/Extensions/News/Templates/News/DateMenu.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,53 @@
{namespace n=GeorgRinger\News\ViewHelpers}
<f:layout name="General" />
<!--
=====================
Templates/News/DateMenu.html
-->
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers">

<f:layout name="General" />
<!--
=====================
Templates/News/DateMenu.html
-->

<f:section name="content">
<div class="news-menu-view">
<ul>
<f:for each="{data.single}" key="year" as="months">
<li>
{year}
<ul>
<f:for each="{months}" key="month" as="count">
<f:if condition="{0:year, 1:month} == {0:overwriteDemand.year, 1:overwriteDemand.month}">
<f:then>
<f:comment>
Set title tag for date menu active item
</f:comment>
<n:format.nothing>
<n:titleTag>
<n:format.htmlentitiesDecode><f:cObject typoscriptObjectPath="lib.pageTitle"/> - <f:translate key="month.{month}" /> {year}</n:format.htmlentitiesDecode>
</n:titleTag>
</n:format.nothing>

<li class="item itemactive">
<f:render section="datemenuLink" arguments="{listPid: listPid, year: year, month: month, count: count, entry: entry, entries: entries}"/>
</li>
</f:then>
<f:else>
<li class="item">
<f:render section="datemenuLink" arguments="{listPid: listPid, year: year, month: month, count: count, entry: entry, entries: entries}"/>
</li>
</f:else>
</f:if>
</f:for>
</ul>
</li>
</f:for>
</ul>
</div>
</f:section>

<f:section name="datemenuLink">
<f:link.action pageUid="{listPid}" arguments="{overwriteDemand:{year: year, month: month}}"><f:translate key="month.{month}" /> {year}</f:link.action>
({count} <f:translate key="{f:if(condition: '{count} == 1', then: 'entry', else: 'entries')}" />)
</f:section>
</div>

<f:section name="content">
<div class="news-menu-view">
<ul>
<f:for each="{data.single}" key="year" as="months">
<li>
{year}
<ul>
<f:for each="{months}" key="month" as="count">
<f:if condition="{0:year, 1:month} == {0:overwriteDemand.year, 1:overwriteDemand.month}">
<f:then>
<li class="item itemactive">
</f:then>
<f:else>
<li class="item">
</f:else>
</f:if>
<f:link.action pageUid="{listPid}" arguments="{overwriteDemand:{year: year, month: month}}"><f:translate key="month.{month}" /> {year}</f:link.action>
({count} <f:translate key="{f:if(condition: '{count} == 1', then: 'entry', else: 'entries')}" />)
</li>
</f:for>
</ul>
</li>
</f:for>
</ul>
</div>
</f:section>
Loading

0 comments on commit 7ffe0d9

Please sign in to comment.