athul / archie

A minimal Hugo Theme
https://athul.github.io/archie
MIT License
1.01k stars 308 forks source link

Recommended way to use custom css with Archie #14

Closed francisbarton closed 4 years ago

francisbarton commented 4 years ago

Hi there I am interested in adding a custom css file to make tweaks to my site's appearance. I think it is more sensible to work with a separate file rather than editing the built-in css files (main and dark). Please would you suggest a suitable place to put this file and how to link to it from config.toml so it can be read appropriately? Or is this not possible with this theme?

I've put a line under [params] in config.toml like this:

customCSS = "css/archie_tweaks.css"

but I don't think the theme is set up to include this? I have a file static/css/archie_tweaks.css with a couple of changes in it.

It would be great to have some clarification or guidance. Thank you.

athul commented 4 years ago

Hey, Custom CSS isn't implemented yet, but it's easy to do so. Here is the code. Also add a customCSS key in the config.toml file for it to fully work

{{- if isset .Site.Params "customcss" }}
        <link rel="stylesheet" type="text/css" href="{{ .Site.BaseURL }}{{ .Site.Params.customCSS }}" />
{{- end }}

Just paste the code in https://github.com/athul/archie/blob/master/layouts/partials/header.html

It would also be great, If you would like to send a PR for the same:smile:

Cheers, Athul

francisbarton commented 4 years ago

Thank you Athul!