How can I provide css just to one type of page?!??
Archive
TWIG
{% if page.url == base_url %}
<link rel="stylesheet" href="{{ theme_url }}/css/welcome.css">
{% endif %}
this works. but is there another way of conditionally rendering a stylesheet just for a welcome page?
You could match the template or slug of the page you'd want to add the specific style for, e.g:
TWIG
{# for matching slug #}
{% if page.slug == 'welcome' %}
<link rel="stylesheet" href="{{ theme_url }}/css/welcome.css">
{% endif %}
{# for matching template #}
{% if page.template == 'welcome' %}
<link rel="stylesheet" href="{{ theme_url }}/css/welcome.css">
{% endif %}
---
great. thank you. :D
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1334 | 9 years ago | ||
| 2 | 925 | 9 years ago | ||
| 2 | 4056 | 9 years ago | ||
| 1 | 2939 | 9 years ago | ||
| 3 | 1112 | 9 years ago |