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¶
-
special.value
¶ -
- Type
- integer /stdWrap
UID of the page for which related pages by keyword should be found.
Example: Find related pages of the current page¶
lib.relatedPagesMenu = HMENU
lib.relatedPagesMenu {
special = keywords
special {
value.data = TSFE:id
entryLevel = 1
mode = manual
}
// render the menu
}
special.mode¶
-
special.mode
¶ -
- Type
- string
- Default
SYS_LASTCHANGED
Which field in the
pages
table should be used for sorting?Possible values are:
SYS_LASTCHANGED
- Is updated to the youngest time stamp of the records on the page when a page is generated.
manual
orlastUpdated
- Uses the field
lastUpdated
, which can be set manually in the page record. tstamp
- Uses the
tstamp
field of the page record, which is set automatically when the record is changed. crdate
- Uses the
crdate
field of the page record. This field is set once on creation of the record and left unchanged afterwards. starttime
- Uses the
starttime
field.
special.entryLevel¶
-
special.entryLevel
¶ -
- Type
- integer
Where in the root line the search begins.
See property entryLevel in the HMENU.
special.depth¶
-
special.depth
¶ -
- Type
- integer
- Default
- 20
Same as in section "special = updated".
special.limit¶
-
special.limit
¶ -
- Type
- integer
- Default
- 10
Maximal number of items in the menu. Default is 10, maximum is 100.
special.excludeNoSearchPages¶
-
special.excludeNoSearchPages
¶ -
- Type
- boolean
- Default
- false
- Property
- special.excludeNoSearchPages
- Data type
- boolean
- Description
- If set, pages marked
No search
are not included.
special.begin¶
-
special.begin
¶ -
- Type
- boolean
special.setKeywords¶
special.keywordsField¶
-
special.keywordsField
¶ -
- Type
- string
- Default
keywords
Defines the field in the
pages
table in which to search for the keywords. Default is the field namekeyword
. No check is done to see if the field you enter here exists, so make sure to enter an existing field.
special.keywordsField.sourceField¶
-
special.keywordsField.sourceField
¶ -
- Type
- string
- Default
keywords
Defines the field from the current page from which to take the keywords being matched. The default is
keyword
. (Notice that special.setKeywords is only setting the page record field to search in!)
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 = menu
10 {
special = keywords
special {
value.field = pages
excludeNoSearchPages = 1
}
alternativeSortingField = title
dataProcessing {
10 = files
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>