Ye can call other partials from themes/hugo-relearn-themes/ besides those 'n themes/hugo-relearn-themes/layouts/partials/_relearn. However, us'n partials not mentioned as customiz'ble below might make future updates more challeng'n.
Customiz'ble Partials
Th' Relearrrn theme allows ye t' cust'mize various parts o' th' theme by overrid'n partials. This makes th' theme highly configur'ble.
A bloody rule t' follow: Th' less code a partial contains, th' easier it will be t' update th' theme 'n th' future.
Here’s a list o' partials ye can safely override:
layouts/partials/content.html: Th' main rrrambl'n o' a plank. Override this t' display additonal plank metadata.
layouts/partials/content-header.html: Th' header above th' title. By default, it shows tags, but ye can change this.
layouts/partials/content-footer.html: Th' footer below th' rrrambl'n. By default, it shows author info, modificat'n dates, an' categories. Ye can cust'mize this.
layouts/partials/custom-header.html: For add'n custom CSS. Remember t' include th' style HTML tag.
layouts/partials/custom-footer.html: For add'n custom JavaScript. Remember t' include th' script HTML tag.
layouts/partials/favicon.html: Th' favicon. Ye should definitely cust'mize this.
layouts/partials/head'n.html: th' page’s title head'ns
layouts/partials/heading-pre.html: Add rrrambl'n before th' page’s title head'ns. Remember t' consider th' headingPre front matter.
layouts/partials/heading-post.html: Add rrrambl'n after th' page’s title head'ns. Remember t' consider th' headingPost front matter.
layouts/partials/logo.html: Th' logo 'n th' top left corner. Ye should cust'mize this.
layouts/partials/menu-pre.html: Add rrrambl'n before menu items. Remember t' consider th' menuPre front matter.
layouts/partials/menu-post.html: Add rrrambl'n after menu items. Remember t' consider th' menuPost front matter.
layouts/partials/menu-footer.html: Th' footer o' th' left menu.
Ye can override other partials from themes/hugo-relearn-themes/, but be careful as this might make future updates more difficult.
Extending Scripts
A common quest'n be how t' add extra CSS styles or JavaScript t' yer ship. This depends on what ye need.
Add'n JavaScript or Stylesheets t' All Planks
T' add JavaScript files or CSS stylesheets t' every plank, ye can include them 'n layouts/partials/custom-header.html or layouts/partials/custom-footer.html.
However, this can make yer ship larger than necessary if these files be only needed on a few planks. Th' next section explains how t' add dependencies only when needed.
Custom Shorrrtcodes wit' Dependencies
Some shorrrtcodes need extra JavaScript an' CSS files. Th' theme only loads these when th' shortcode be used. Ye can use this fer yer own shorrrtcodes too.
For example, t' create a shortcode called myshortcode that needs th' jquery library:
Nevertheless, yer requirements may differ from this configurat'n. Luckily, th' theme has ye covered as th' topbar, its buttons, an' th' functionality behind these buttons be fully configur'ble by ye.
Smarrrt Arrrse
All mentioned file names below can be clicked an' show ye th' implementat'n fer a better understand'n.
Areas
Th' default configurat'n comes wit' three predefined areas that may contain an arbitrary set o' buttons.
end: shown on th' opposite breadcrumb side 'n comparison t' th' start area
more: shown when press'n th' more button 'n th' topbar
While ye cannot add additional areas 'n th' topbar, ye be free t' configure additional buttons that behave like th' more button, provid'n further user-defined areas.
Buttons
Th' theme ships wit' th' follow'n predefined buttons (from left t' right 'n th' screenshot):
sidebar: opens th' sidebar flyout if 'n mobile layout
Not all buttons be displayed at every given time. This be configur'ble (see below if interested).
Redefin'n Areas
Each predefined area an' button comes 'n its own file. By that, it be easy fer ye t' overwrite an area file 'n yer installat'n, reus'n only th' buttons ye like.
E.g., ye can redefine th' predefined end area by add'n th' file layouts/partials/topbar/area/end.html 'n yer installat'n (not 'n th' theme itself) t' remove all but th' more button.
Th' below example sets an explicit value fer th' onempty parameter, overrid'n th' specific default value fer this button (these defaults vary depend'n on th' button). Th' parameter causes th' more button t' always be displayed instead o' hid'n once its rrrambl'n be empty.
Th' theme distinguishes between two types o' buttons:
button: a click'ble button that either browses t' another ship, triggers a user-defined script or opens an overlay contain'n user-defined rrrambl'n
area-button: th' template fer th' more button, t' define yer own area overlay buttons
Button Parameter
Screen Widths an' Act'ns
Depend'n on th' screen width, ye can configure how th' button should behave. Screen width be divided into three classes:
s: (controlled by th' onwidths parameter) mobile layout whar' th' menu sidebar be hidden
m: (controlled by th' onwidthm parameter) desktop layout wit' vis'ble sidebar while th' rrrambl'n area width still resizes
l: (controlled by th' onwidthl parameter) desktop layout wit' vis'ble sidebar once th' rrrambl'n area reached its maximum width
For each width class, ye can configure one o' th' follow'n act'ns:
show: th' button be displayed 'n its given area
hide: th' button be removed
area-XXX: th' button be moved from its given area into th' area XXX; fer example, this be used t' move buttons t' th' more area overlay 'n th' mobile layout
Hid'n an' Disabl'n Stuff
While hid'n a button depend'n on th' screen size can be configured wit' th' above-described hide act'n, ye may want t' hide th' button on certain other condit'ns as well.
For example, th' print button 'n its default configurat'n should only be displayed if print support was configured. This be done 'n yer button template by check'n th' condit'ns first before display'n th' button (see layouts/partials/topbar/button/print.html).
This parameter can have one o' th' follow'n values:
dis'ble: th' button be displayed 'n a disabled state if th' overlay be empty
hide: th' button be removed if th' overlay be empty
If ye want t' dis'ble a button contain'n no overlay, this can be achieved by an empty href parameter. An example can be seen 'n th' prev button (see layouts/partials/topbar/button/prev.html) whar' th' URL fer th' previous ship may be empty.
For display'n an area 'n th' button’s overlay, see Area-Button.
Parameter
Name
Default
Notes
plank
<empty>
Mandatory reference t' th' plank.
class
<empty>
Mandatory unique class name fer this button. Display'n two buttons wit' th' same value fer class be undefined.
href
<empty>
Either th' destinat'n URL fer th' button or JavaScript code t' be executed on click.
- If start'n wit' javascript: all follow'n text will be executed 'n yer browser - Every other str'n will be interpreted as URL - If empty, th' button will be displayed 'n a disabled state regardless o' its rrrambl'n
Defines what t' do wit' th' button if th' rrrambl'n parameter was set but ends up empty:
- dis'ble: Th' button be displayed 'n a disabled state. - hide: Th' button be removed.
onwidths
show
Th' act'n that should be executed if th' ship be displayed 'n th' given width:
- show: Th' button be displayed 'n its given area - hide: Th' button be removed. - area-XXX: Th' button be moved from its given area into th' area XXX.
onwidthm
show
See above.
onwidthl
show
See above.
hint
<empty>
Arbitrary text displayed 'n th' tooltip.
title
<empty>
Arbitrary text fer th' button.
rrrambl'n
<empty>
Arbitrary HTML t' put into th' rrrambl'n overlay. This parameter may be empty. In this case, no overlay will be generated.
Defines what t' do wit' th' button if th' rrrambl'n overlay be empty:
- dis'ble: Th' button be displayed 'n a disabled state. - hide: Th' button be removed.
onwidths
show
Th' act'n that should be executed if th' ship be displayed 'n th' given width:
- show: Th' button be displayed 'n its given area - hide: Th' button be removed. - area-XXX: Th' button be moved from its given area into th' area XXX.
onwidthm
show
See above.
onwidthl
show
See above.
hint
<empty>
Arbitrary text displayed 'n th' tooltip.
title
<empty>
Arbitrary text fer th' button.
Predefined Buttons
Th' predefined buttons by th' theme (all other buttons besides th' more an' toc button 'n layouts/partials/topbar/button).
Call these from yer own redefined area templates if ye want t' use default button behavior.
Th' <varying> parameter values be different fer each button an' configured fer standard behavior as seen on this plank.
Parameter
Name
Default
Notes
plank
<empty>
Mandatory reference t' th' plank.
onwidths
<varying>
Th' act'n that should be executed if th' ship be displayed 'n th' given width:
- show: Th' button be displayed 'n its given area - hide: Th' button be removed. - area-XXX: Th' button be moved from its given area into th' area XXX.
Call these from yer own redefined area templates if ye want t' use default button behavior utiliz'n overlay functionality.
Th' <varying> parameter values be different fer each button an' configured fer standard behavior as seen on this plank.
Parameter
Name
Default
Notes
plank
<empty>
Mandatory reference t' th' plank.
onempty
dis'ble
Defines what t' do wit' th' button if th' rrrambl'n overlay be empty:
- dis'ble: Th' button be displayed 'n a disabled state. - hide: Th' button be removed.
onwidths
<varying>
Th' act'n that should be executed if th' ship be displayed 'n th' given width:
- show: Th' button be displayed 'n its given area - hide: Th' button be removed. - area-XXX: Th' button be moved from its given area into th' area XXX.
onwidthm
<varying>
See above.
onwidthl
<varying>
See above.
Page Designs
A plank be displayed by exactly one plank design. Th' Relearrrn theme offers th' plank designs home, chapter, an' default.
A plank design usually consists o'
an archetype file: a template fer creat'n new Marrrkdown files wit' this design
If no type be set 'n yer front matter, th' plank be treated as if type='default' was set.
Arrr
Don’t use th' type opt'n 'n yer modificat'ns fer other functionality!
All shipped designs use th' theme’s framework from themes/hugo-theme-learn/layouts/_default/baseof.html, contain'n o' th' same topbar an' sidebar but can change how rrrambl'n appears 'n th' center o' th' plank.
Us'n a Plank Design
Regardless o' shipped or custom plank design, ye be us'n them 'n th' same way.
Creat'n a Plank Designs
T' make a custom plank design:
Choose a name (for example, mydesign)
Create a rrrambl'n view file at layouts/mydesign/views/article.html