Discussion:
[hakyll] include css using metadata
'Stéphane Laurent' via hakyll
2017-03-11 15:42:08 UTC
Permalink
Hello,

I'm new to Hakyll.
Is there a way to add something in the header with the help of the metadata
? I tried this and this doesn't work:

*---*
*title: Test*
*header-includes:*
* <link rel="stylesheet" href="../css/hk-kate.css"/>*
*---*


I expected to get <link ....> in the <head> tag of the html.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jasper Van der Jeugt
2017-03-14 11:52:19 UTC
Permalink
Adding this to Hakyll is fairly easy. As you suggest, you start by
adding it to the you page:

---
title: Test
header-includes:
<link rel="stylesheet" href="../css/hk-kate.css"/>
---

Now, you want to make sure it gets included in your template. Most
people have a "default" template that adds most of the HTML
boilerplate (charset, title and so on...) so I recommend adding it
there. E.g. `templates/default.html`:

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
...
$if(header-includes)$
$header-includes$
$endif$
...
</head>
<body>
...

That will include the string specified in the metadata (if any).

Hope this helps,
Jasper

On Sat, Mar 11, 2017 at 4:42 PM, 'Stéphane Laurent' via hakyll
Post by 'Stéphane Laurent' via hakyll
Hello,
I'm new to Hakyll.
Is there a way to add something in the header with the help of the metadata
---
title: Test
<link rel="stylesheet" href="../css/hk-kate.css"/>
---
I expected to get <link ....> in the <head> tag of the html.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...