Show Menu
Cheatography

TYPO3: New Website Cheat Sheet by

Basic TypoScript etc. for creating a new TYPO3 Website.

Constants: Basic Constants

domain
To globally change your domain (to go live for example)
protocol
Globally change your protocol. e.g. from http:// to https://
fileadmin
change the basic path to your fileadmin directory (filead­min­/ol­d_files to filead­min­/ne­w_files)

TypoSc­ript: Basic Config­uration

config {

doctype = html5
xmlpro­logue = none

baseURL = {$prot­oco­l}:­//{­$do­main}

language = de
locale_all = german
htmlTa­g_l­angKey = de
sys_la­ngu­age_uid = 0

# Add L Parameter to links
linkVars := addToL­ist(L)
unique­Lin­kVars = 1

# Enable ReaURL
tx_rea­lur­l_e­nable = 1

# Decide for yourself
moveJs­Fro­mHe­ade­rTo­Footer = 0

# AdminPanel on
admPanel = 1

# Pagetitle off
noPage­Title = 2

# Spam-P­rot­ection - choose your favorite method
spamPr­ote­ctE­mai­lAd­dresses = ascii
}
 

Typosc­ript: Change Website Title

page.h­ead­erData {
10 = TEXT
10 {
field = title
noTrimWrap = |<t­itl­e>| - Websit­e</­tit­le>|
}
}
config.no­Pag­eTitle = 2
is mandatory

TypoSc­ript: Fav Icon

page.s­hor­tcu­tIcon = {$file­adm­in}­/fa­vic­on.ico

TypoSc­ript: Language Condition

[globalVar = GP:L = 1]
config.sy­s_l­ang­uag­e_uid = 1
config.la­nguage = en
config.lo­cal­e_all = english
config.ht­mlT­ag_­langKey = en
[global]

TypoSc­ript: Add Meta-Tag "­vie­wpo­rt"

page.m­eta.vi­ewport = width=­dev­ice­-width, initia­l-s­cale=1, maximu­m-s­cale=1, user-s­cal­able=no

TypoSc­ript: Canoci­al-Tag

page.h­ead­erD­ata.930 = TEXT
page.h­ead­erD­ata.930 {
typolink {
parameter = {page:uid}
parame­ter.in­ser­tData = 1
useCac­heHash = 1
addQue­ryS­tring = 1
addQue­ryS­tri­ng.m­ethod = GET
addQue­ryS­tri­ng.e­xclude = id,no_­cac­he,­tt_­new­s[b­ackPid]
returnLast = url
}
wrap = <link rel="ca­non­ica­l" href="{­$pr­oto­col­}:/­/{$­dom­ain­}|" />
}
 

TypoSc­ript: Backend Layout

page.10 = FLUIDT­EMPLATE
page.10 {

# Use the constants in your tpls
variables {
domain = TEXT
domain.value = {$domain}
protocol = TEXT
protoc­ol.v­alue = {$prot­ocol}
fileadmin = TEXT
filead­min.value = {$file­admin}
# e.g. for anchor urls
typo3_­req­ues­t_url = TEXT
typo3_­req­ues­t_u­rl.data = getInd­pEnv: TYPO3_­REQ­UES­T_URL

}

file.s­tdW­rap.cO­bject = CASE
file.s­tdW­rap.cO­bject {

key.data = levelf­iel­d:-1, backen­d_l­ayo­ut_­nex­t_l­evel, slide
key.ov­err­ide.field = backen­d_l­ayout

# default template file
default = TEXT
defaul­t.value = {$file­adm­in}­/tp­l/d­efa­ult.html
2 = TEXT
2.value = {$file­adm­in}­/tp­l/a­lt_­one.html
3 = TEXT
3.value = {$file­adm­in}­/tp­l/a­lt_­two.html
}
}
 

Comments

Please feel free to tell me what your would like to see in this cheat sheet. I am going to extend it from time to time with new or better typoscript solutions.

Thanks

Can we add css/js include via typoscript ? (includeCSS,includeJS )
Also add other meta tags like, author, keywords,description, robots,X-UA-Compatible ..etc
bodyTagAdd ??

Thanks

You cheat sheet has been linked on the official TYPO3 page https://docs.typo3.org/m/typo3/docs-cheatsheets/master/en-us/CheatSheets.html#cheat-sheets.

We would like to restrict the list to only the cheat sheets that are up to date for the respective version (you can switch to the other versions by clicking "Related links in menu bottom left").

It would be great if you could create a seperate cheat sheet for each major version (7.6, 8.7, 9.5, 10...) or alternatively a "one fits all" which marks things as outdated that are no longer in current LTS (9.5).

Please feel free to contact us on Slack in #typo3-documentation, see https://typo3.org/community/teams/documentation/#c9886

Sybille Peters (TYPO3 Documentation Team)

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Wikipedia Cheat Sheet
          Cheatography Cheat Sheet
          Reddit Cheat Sheet