Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Theme resources can be stored in light (YAML) or Maven modules. Themes can reside in a dedicated theme module or form part of another module. A special module version handler is not necessary.

...

  • Theme resources are applied to the entire site.
  • Resources are all in one place.
  • Themes are an easy way to work with resources without having to modify the head section of your HTML
  • You can define more than one theme and switch between them, or apply a different theme to a variation of your site. For example, you could use a different theme for pages targeted at U.S. users and European users, or a seasonal theme for different times of the year.
  • You can still use different or additional overriding resources on a page-template level.

Configuring a theme with YAML

(warning) Magnolia 5.4.6+

See Using a site definition for an example with a YAML file based theme.

Configuring a theme with JCR

Themes are configured in the Themes tab of the Site app.

...

Three configuration nodes define the individual elements of a theme:

travel-demo-theme 

cssFiles

Optional

References CSS files.

jsFiles

Optional

References JavaScript files.

imaging

Optional

Defines image variations a.k.a renditions.

...

Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

Mgnl n
my-theme

 

Mgnl n
cssFiles

 


Mgnl n
bootstrap

 

Mgnl p
addFingerPrint

true

Mgnl p
link

/.resources/travel-demo-theme/libs/twitterbootstrap/css/bootstrap.min.css

Mgnl p
media

all

Mgnl n
travels-magnolia

 

Mgnl p
addFingerPrint

true

Mgnl p
link

/.resources/travel-demo-theme/css/travels-magnolia.css

Mgnl p
media

all

Mgnl n
roboto-condensed

 

Mgnl p
addFingerPrint

true

Mgnl p
link

https://fonts.googleapis.com/css?family=Roboto+Condensed:400,300,700

Mgnl p
media

all

...

Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
 
Node nameValue

Mgnl n
my-theme


Mgnl n
jsFiles

 

Mgnl n
modernizer

 

Mgnl p
addFingerPrint

true

Mgnl p
link

/.resources/travel-demo-theme/js/modernizr-2.6.2.min.js

...

Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

Mgnl n
travel-demo-theme

 

Mgnl n
imaging

 

Mgnl n
variations

 

Mgnl n
1600

 


Mgnl p
class

info.magnolia.templating.imaging.variation.SimpleResizeVariation

Mgnl p
width

1600

Mgnl n
1366

 


Mgnl n
...

 

Mgnl n
240

 


Mgnl n
1600x1200

 


Mgnl p
class

info.magnolia.templating.imaging.variation.SimpleResizeVariation

Mgnl p
height

1200

Mgnl p
width 

1600

Mgnl n
1366x1024

 


Mgnl n
...

 

Mgnl n
240x180

 

Mgnl p
class

info.magnolia.templating.imaging.VariationAwareImagingSupport

...

Properties:

<variation name> 

class

required

SimpleResizeVariation resizes images to a defined size.

crop

optional, default is true

Whether cropping is allowed.

height

optional

An integer that defines the height in pixels.

width

optional

An integer that defines the width in pixels.

...

  • Although both the width and height properties are optional you must configure at least one. If you omit both the renderer intentionally throws an internal ImagingException and the image displays in it's original uploaded size.
  • If you define both width and height the image is sized down to the lower of the two and the rest is cropped, if necessary. Cropping starts from the middle, so the image is either cropped on top and bottom, or left and right.
  • If you define only width or height, the omitted property is calculated using the aspect ratio of the original image.
  • if you set crop to false, the image is resized to the specified size, and may be distorted (stretched).

See damfn and Working How to work with images using damfn for how to use variations in your scripts.

...

Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

Mgnl n
templates

 


Mgnl n
themes

 

Mgnl p
name

travel-demo-theme

Mgnl n
i18n

 


Properties:

themes

required

Theme node.

name

required

The value of this property must match the name of the theme configured in /modules/site/config/themes.

...