ForgeCrowdBookWe don't sell the fish – we give you the rod.

Look and Feel

Your site works. Now it should look like you: your colours, a font that fits, your pictures, maybe a video. ForgeCMS has a built-in design that looks decent on every screen, and a small file that changes it.

Goal

By the end of this chapter you can:

  • change colours, font and shapes of your whole site with a few lines,
  • add a logo and a favicon,
  • use pictures and videos on your pages,
  • know when to ask for more.

The theme

The look of your site is described in a file theme.sml on your server, next to app.sml. It only needs the values you want to change; everything else comes from the built-in design. This is the bakery's theme:

Theme {
    primary:    "#8a4b2a"
    background: "#fbf7f1"
    link:       "#8a4b2a"
    font:       "serif"
    hero:       "gradient"
}

And this is the difference those five lines make. First the built-in design:

The built-in design

Then with the bakery's theme:

With the bakery's theme

These are the values you can set:

Value What it changes Example
primary main colour: banner, buttons, active elements "#8a4b2a"
background page background "#fbf7f1"
surface background of cards and boxes "#ffffff"
text text colour "#2b2622"
link link colour "#8a4b2a"
border lines and frames "#e6dfd7"
hero the banner at the top: "gradient" or "flat" (one colour) "flat"
hero_text text colour on the banner "#ffffff"
font "sans", "serif", "mono" or the name of a font "serif"
font_size text size in pixels 17
h1 … h4 heading sizes in pixels 36
radius how round the corners are, in pixels (0 = square) 12
width maximum width of the content in pixels 1100
logo picture in the top left instead of the site name "/static/logo.png"
favicon the small icon in the browser tab "/static/favicon.svg"

Colours are written as # and six hexadecimal digits, the way every drawing program shows them. If you do not know your colours, ask the AI: "Make a theme in warm browns that fits a bakery", or give it a picture: "Take the colours from our shop sign" and upload a photo of it.

Because the theme is on the server, changing it is a request to the AI, or a small edit with the AI's help. That is deliberate: the look changes rarely, the texts often.

Readable on every screen

You do not have to do anything for phones. The built-in design adapts by itself: the menu wraps, columns stack, tables stay readable.

The price list on a phone

Still, look at your site on a phone after every bigger change. Most visitors will see it there first.

Pictures

Pictures live in the static/ folder of your content repo (chapter 5). There are three ways to show them.

In a text, between paragraphs:

![Our oven at five in the morning](/static/images/oven.jpg)

As an element on the page, with more control:

Image { src: "/static/images/oven.jpg"  alt: "Our oven at five in the morning"  width: "600" }

href makes the picture a link, and mobile names a second picture for narrow screens, for example a portrait crop of a wide photo.

Behind the banner at the top of a page:

Hero {
    heading: "Fresh bread, every morning"
    subtext: "Family bakery in Wittenberg since 1987"
    image:   "/static/images/oven.jpg"
}

ForgeCMS puts a dark layer over the picture so the heading stays readable.

Always write the alt text: it is what blind visitors hear, and what appears when a picture does not load. Describe what is in the picture, not the file name.

Videos

A line in a text that is nothing but a YouTube or PeerTube address becomes a video player:

Here is how we make our sourdough:

https://www.youtube.com/watch?v=VIDEO-ID

Or as an element on the page:

YouTube { url: "https://www.youtube.com/watch?v=VIDEO-ID"  title: "How we make sourdough" }

ForgeCMS embeds YouTube through youtube-nocookie.com, so YouTube sets no cookies until the visitor presses play.

When you need more

Theme values cover most wishes. For anything else, such as a special box, a different menu or a font from your corporate design, there is the site's own stylesheet, static/style.css on the server. You do not have to learn CSS; describe what you want:

The cards on the home page should have a thin brown border and no shadow.

The AI decides whether this is a theme value, a CSS rule or a different SML element, and tells you which. If you ask why, you will learn a little each time.

Pitfalls

  • Huge photos: a picture straight from the phone makes the page slow, especially on mobile data. Around 1600 pixels wide is enough for a banner, 800 for a picture in a text.
  • Light text on a light picture: check the banner on a phone, where the picture is cut differently.
  • Too many colours: one main colour and one for links is usually enough. Calm sites are easier to read.
  • Copied pictures: only use pictures you took, bought, or that are explicitly free to use.

What you learned

  • theme.sml next to app.sml changes colours, font, sizes and corners of the whole site; it only needs the values you change.
  • Logo and favicon are two theme values.
  • Pictures from static/: in Markdown, as Image { }, or behind a Hero { }. Always with alt.
  • A YouTube or PeerTube address alone on a line becomes a player, without cookies until play.
  • For more, describe the result; the AI picks the tool.

The last chapter of this part is about the day you come back after half a year and have forgotten everything.