Link to stylesheet and other files in your theme
Guide to linking to stylesheets, JavaScript and other files from your Shoporama theme.
Når du linker til stylesheets, JavaScript-filer eller billeder i dit Shoporama-tema, er det vigtigt at bruge de korrekte stier. Her gennemgår vi, hvordan du gør det rigtigt.

Brug $theme_url
Variablen {$theme_url} peger på dit temas rodmappe. Brug den til at linke til alle filer i dit tema:
<!-- Stylesheet -->
<link rel="stylesheet" href="<{$theme_url}>/css/style.css">
<!-- JavaScript -->
<script src="<{$theme_url}>/js/main.js"></script>
<!-- Billede -->
<img src="<{$theme_url}>/img/logo.png" alt="Logo">
Hvorfor $theme_url?
Grunden til at bruge {$theme_url} i stedet for en hardcodet sti:
- Portabilitet — temaet virker uanset, hvor det er installeret
- CDN-understøttelse — URL'en kan automatisk pege på et CDN
- Fleksibilitet — temaets mappe kan flyttes uden at ændre kode
Andre nyttige URL-variabler
| Variabel | Beskrivelse |
|---|---|
| {$theme_url} | Temaets rodmappe (til CSS, JS, billeder) |
| {$baseurl} | Shoppens fulde URL (fx https://minshop.dk) |
| {$webshop} | Webshop-objektet med alle indstillinger |
Vigtigt
Brug aldrig absolutte stier som /user_templates/4/mittema/css/style.css. Det vil bryde, hvis temaet flyttes eller installeres på en anden shop.
Har du brug for hjælp med tema-udvikling? Kontakt os på support@shoporama.dk.
Related articles
Own stylesheet (Custom CSS)
Add custom CSS to your Shoporama online store and admin backend. Customize colors, fonts, layout and hide elements without changing theme files.
Email templates in your theme
Overview of all email templates in Shoporama themes. Learn what each template does, when it's sent, and what variables you can use to customize...
Implement Theme Builder in your theme
Guide to implementing Shoporama's Theme Builder in your theme so the merchant can build pages visually.