Discussion:
[hakyll] Automatically linking headlines to themselves
Troels Henriksen
2018-08-02 08:04:34 UTC
Permalink
I know how to make headlines/titles have `id` attributes such that they can
be the target of links. However, how can I use Hakyll to automatically
embed such a link into the generated HTML next to the title itself? As an
example, consider the (hidden until hovered over) links to the right of
titles generated with Sphinx:
http://www.sphinx-doc.org/en/master/usage/quickstart.html#defining-document-structure

It can probably be done by postprocessing the HTML, but is there a nicer
way?
--
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
2018-08-03 00:52:31 UTC
Permalink
Hi Troels,

This requires a little bit of code. I am doing it here in the Summer of
Haskell website:

https://github.com/haskell-org/summer-of-haskell/blob/master/src/Main.hs#L85-L95

You should be able to adapt that snippet quite easily, but let me know
if it doesn't work.

Cheers
Jasper
Post by Troels Henriksen
I know how to make headlines/titles have `id` attributes such that they can
be the target of links. However, how can I use Hakyll to automatically
embed such a link into the generated HTML next to the title itself? As an
example, consider the (hidden until hovered over) links to the right of
http://www.sphinx-doc.org/en/master/usage/quickstart.html#defining-document-structure
It can probably be done by postprocessing the HTML, but is there a nicer
way?
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
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.
a***@gmail.com
2018-08-03 09:51:44 UTC
Permalink
Ah yes, that is quite close to what I came up with myself:
https://github.com/diku-dk/futhark-website/blob/6f5bf9a4cfe52a3ee0541dcdc33b5a5dd8d0fd9e/site.hs#L141-L146
--
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...