[SOLVED] How to use two CSS file?

Hello dear Developers,

I have 2 css file:

I want to use index.css on the main page and single.css on the posts page.
How can I do this in the section?

Thank you!

Plenty of functions for you to test, quick to come to mind is {{ if eq .Section "posts" }}. You’d have to be more precise than that for us to pinpoint to correct conditional though.

Thank you very much!

my solution is:

  {{ if eq .Section "post" }}<link rel="stylesheet" href="{{ "css/post.css" | absURL }}" />{{ else }}<link rel="stylesheet" href="{{ "css/index.css" | absURL }}" />{{ end }}

And it works!
Thank you!

1 Like

Please don’t forget to mark the answer in the thread using the checkbox icon from the comment action menu. This marks the thread as solved.

1 Like