Skip to content

Instantly share code, notes, and snippets.

@andyhausmann
Created March 20, 2015 09:19
Show Gist options
  • Save andyhausmann/95874a656a22b157bf65 to your computer and use it in GitHub Desktop.
Save andyhausmann/95874a656a22b157bf65 to your computer and use it in GitHub Desktop.
##
# Create shorthand namespace for our site package name.
# It is available in all included typoscript files.
#
namespace: Site=TYPO3.NeosDemoTypo3Org
include: NodeTypes/*
/**
* Root TypoScript template for the Neos demo website
*/
page = Page {
head {
stylesheets {
site = TYPO3.TypoScript:Template {
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/Default.html'
sectionName = 'stylesheets'
node = ${node}
}
}
metadata = TYPO3.TypoScript:Template {
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/Default.html'
sectionName = 'metadata'
}
javascripts {
site = TYPO3.TypoScript:Template {
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/Default.html'
sectionName = 'javascripts'
}
}
titleTag {
// Overwrite the title tags content with a collection to create a breadcrumb
content = TYPO3.TypoScript:Collection {
// Retrieve all parent document nodes excluding the homepage
collection = ${q(documentNode).add(q(documentNode).parents()).slice(0, -1).get()}
itemName = 'node'
iterationName = 'nodeIterator'
// Implode node titles with a dash
itemRenderer = ${q(node).property('title') + (nodeIterator.isLast ? '' : ' - ')}
// Always add general site name as suffix
@process.siteName = ${(value ? String.stripTags(value) + ' - ' : '') + 'TYPO3 Neos'}
}
}
}
// This query checks if the second level menu has items and sets an additional class for the body
bodyTag.attributes.class = ${q(node).parents().count() >= 1 && q(node).children('[instanceof TYPO3.Neos:Document]').filter('[_hiddenInIndex=false]').count() > 0 ? 'has-subpages' : ''}
body {
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/Default.html'
sectionName = 'body'
imageUri = TYPO3.Neos:ImageUri {
asset = ${q(node).property('image')}
maximumWidth = 2560
maximumHeight = 1280
@if.image = ${q(node).property('image')}
}
imageTitleText = ${q(node).property('imageTitleText')}
parts {
mainMenu = Menu {
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/TypoScriptObjects/MainMenu.html'
itemCollection = ${q(site).add(q(site).children('[instanceof TYPO3.Neos:Document]')).get()}
}
secondLevelMenu = Menu {
entryLevel = 2
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/TypoScriptObjects/SecondLevelMenu.html'
maximumLevels = 1
}
metaMenu = Menu {
entryLevel = 2
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/TypoScriptObjects/MetaMenu.html'
maximumLevels = 1
startingPoint = ${q(site).children('metamenu').get(0)}
}
breadcrumb = BreadcrumbMenu
languageMenu = TYPO3.Neos:DimensionMenu {
dimension = 'language'
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/TypoScriptObjects/LanguageMenu.html'
}
}
content {
teaser = ContentCollection {
nodePath = 'teaser'
}
// Default content section
main = PrimaryContent {
nodePath = 'main'
}
}
// A shared footer which can be edited from all pages
footer = ContentCollection {
nodePath = ${q(site).children('footer').property('_path')}
collection = ${q(site).children('footer').children()}
}
javascripts.site = TYPO3.TypoScript:Template {
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/Default.html'
sectionName = 'bodyScripts'
}
}
}
default < page
// Special page layout with less navigation components
landingPage < page
landingPage.body {
// Hide breadcrumb on landing pages
parts.breadcrumb >
landingPage = ${true}
}
// Special layout for chapter nodes
chapter < page
chapter {
bodyTag.attributes.class = 'chapter'
body {
templatePath = 'resource://TYPO3.NeosDemoTypo3Org/Private/Templates/Page/Chapter.html'
title = ${q(node).property('title')}
title.@process.convertUris = ConvertUris
// Get the previous chapter by traversing to the node which preceds the current one.
// We need to specify the nodetype because there could be other node types like content collections on the same level.
previousChapter = ${q(documentNode).prev('[instanceof TYPO3.Neos:Document]').get(0)}
nextChapter = ${q(documentNode).next('[instanceof TYPO3.Neos:Document]').get(0)}
}
}
print < page
print {
head {
stylesheets.printCss = TYPO3.TypoScript:Tag {
@position = 'end 10'
tagName = 'link'
attributes {
media = 'all'
rel = 'stylesheet'
href = TYPO3.TypoScript:ResourceUri {
path = 'resource://TYPO3.NeosDemoTypo3Org/Public/Styles/Print.css'
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment