Keywords - menu of related pages¶
Makes a menu of pages, which contain one or more keywords also found on the current page.
Mount pages are supported.
Properties¶
special.value¶
Property
special.value
Data type
integer /stdWrap
Description
Page for which keywords to find similar pages
Example:
lib.relatedPagesMenu = HMENU
lib.relatedPagesMenu {
special = keywords
special {
value.data = TSFE:id
entryLevel = 1
mode = manual
}
// render the menu
}
special.mode¶
Property
special.mode
Data type
string
Default
SYS_LASTCHANGED
Description
Which field in the pages table to use for sorting.
Possible values are:
- SYS_LASTCHANGED:
Is updated to the youngest tstamp of the records on the page when a page is generated.
- manual or lastUpdated:
Uses the field "lastUpdated", which can be set manually in the page-record.
- tstamp:
Uses the "tstamp"-field of the pagerecord, which is set automatically when the record is changed.
- crdate:
Uses the "crdate"-field of the pagerecord.
- starttime:
Uses the starttime field.
special.entryLevel¶
Property
special.entryLevel
Data type
integer
special.depth¶
Property
special.depth
Data type
integer
Default
20
Description
(same as in section "special = updated")
special.limit¶
Property
special.limit
Data type
integer
Default
10
Description
(same as in section "special = updated")
special.excludeNoSearchPages¶
Property
special.excludeNoSearchPages
Data type
boolean
Description
(same as in section "special = updated")
special.begin¶
Property
special.begin
Data type
boolean
Description
(same as in section "special = updated")
special.setKeywords¶
Property
special.setKeywords
Data type
string /stdWrap
Description
Lets you define the keywords manually by defining them as a comma- separated list. If this property is defined, it overrides the default, which is the keywords of the current page.
special.keywordsField¶
Property
special.keywordsField
Data type
string
Default
keywords
Description
Defines the field in the pages table in which to search for the keywords. Default is the field name "keyword". No check is done to see if the field you enter here exists, so make sure to enter an existing field!
special.keywordsField.sourceField¶
Property
special.keywordsField.sourceField
Data type
string
Default
keywords
Description
Defines the field from the current page from which to take the keywords being matched. The default is "keyword". (Notice that ".keywordsField" is only setting the page-record field to search in!)
[tsref:(cObject).HMENU.special = keywords]
Example¶
Menu of related pages¶
The content element Menu > Related pages provided by the system
Extension EXT:fluid_styled_content is configured with a MenuProcessor
which is based on the options of the HMENU and provides
all its properties:
# Related pages (based on keywords):
# ...
#
# CType: menu_related_pages
tt_content.menu_related_pages =< lib.contentElement
tt_content.menu_related_pages {
templateName = MenuRelatedPages
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = keywords
special {
value.field = pages
excludeNoSearchPages = 1
}
alternativeSortingField = title
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media
}
}
}
}
}
The following Fluid template can be used to style the menu:
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="Default" />
<f:section name="Main">
<f:if condition="{menu}">
<ul>
<f:for each="{menu}" as="page">
<li>
<a href="{page.link}"{f:if(condition: page.target, then: ' target="{page.target}"')}{f:if(condition: page.current, then: ' aria-current="page"')} title="{page.title}">
<span>{page.title}</span>
</a>
</li>
</f:for>
</ul>
</f:if>
</f:section>
</html>