Skip to content

How to set separate CSS for a certain type of directory and its subdirectories #7180

Answered by ValiLey
W1ndys asked this question in Q&A
Discussion options

You must be logged in to vote

Would it be an option to create multiple template files in the override directory (like main.html), each referencing a different stylesheet / different color? Like this:

{% extends "base.html" %}

{% block extrahead %}
  <link rel="stylesheet" href="{{ 'assets/stylesheets/color-red.css' | url }}">
{% endblock %}

You can then assign the templates in the frontmatter of your markdown files. Like this:

---
title: I'm a page title
description: I'm a description
template: red.html
---

Maybe it's even possible to use the meta plugin to assign the template to a whole folder instead of adding it to every single file.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@W1ndys
Comment options

@ValiLey
Comment options

@W1ndys
Comment options

Answer selected by W1ndys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants