<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Littlefoot.js on Janusworx</title>
    <link>https://janusworx.com/tags/littlefoot.js/</link>
    <description>Recent content in Littlefoot.js on Janusworx</description>
    <image>
      <title>Janusworx</title>
      <url>https://janusworx.com/images/jw-logo.png</url>
      <link>https://janusworx.com/images/jw-logo.png</link>
    </image>
    <generator>Hugo -- 0.160.1</generator>
    <language>en</language>
    <lastBuildDate>Wed, 28 Feb 2024 08:10:36 +0530</lastBuildDate>
    <atom:link href="https://janusworx.com/tags/littlefoot.js/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Note to Self Footnotes Using Littlefoot.js</title>
      <link>https://janusworx.com/work/note-to-self-footnotes-using-littlefoot.js/</link>
      <pubDate>Wed, 28 Feb 2024 08:10:36 +0530</pubDate>
      <guid>https://janusworx.com/work/note-to-self-footnotes-using-littlefoot.js/</guid>
      <description>&lt;p&gt;&lt;br&gt;

&lt;hr style=&#39;margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;&#39;/&gt;

&lt;figure class=&#34;align-center &#34;&gt;
    &lt;img loading=&#34;lazy&#34; src=&#34;https://janusworx.com/images/2024/footnotes.png#center&#34;
         alt=&#34;Two feet side by side, with a marker illustration on them. theres  a figure 1 on one foot. a small cartoon lion on the other. and a dashed path drawn across one foot to the other, linking them.&#34;/&gt; 
&lt;/figure&gt;
&lt;/p&gt;
&lt;figcaption style=&#34;font-style: italic; text-align: center;  font-size: 85%; color: var(--secondary)&#34;&gt;
&lt;p&gt;Courtesy &lt;a href=&#34;https://flickr.com/photos/dothegreenthing/7401372664/&#34;&gt;dothegreenthing&lt;/a&gt;, &lt;a href=&#34;https://creativecommons.org/licenses/by-nc/2.0/&#34;&gt;CC BY-NC 2.0&lt;/a&gt;, on Flickr&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><br>

<hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

<figure class="align-center ">
    <img loading="lazy" src="/images/2024/footnotes.png#center"
         alt="Two feet side by side, with a marker illustration on them. theres  a figure 1 on one foot. a small cartoon lion on the other. and a dashed path drawn across one foot to the other, linking them."/> 
</figure>
</p>
<figcaption style="font-style: italic; text-align: center;  font-size: 85%; color: var(--secondary)">
<p>Courtesy <a href="https://flickr.com/photos/dothegreenthing/7401372664/">dothegreenthing</a>, <a href="https://creativecommons.org/licenses/by-nc/2.0/">CC BY-NC 2.0</a>, on Flickr</p>
</figcaption>
<p><hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

I have this amazing urge never to leave well enough alone.<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup><br>
The blog uses an amazing theme, called <a href="https://adityatelange.github.io/hugo-PaperMod/">PaperMod</a>.<br>
And ofcourse, like I said, because I can’t leave well enough alone, I’ve customised it heavily.<sup id="fnref:2"><a href="#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup><br>
The fonts are different, there are various kinds of slight colour changes, I bullied <a href="https://github.com/adityatelange">Aditya</a> into showing me how to <a href="https://github.com/adityatelange/hugo-PaperMod/issues/62#issuecomment-1375160640">build a Menu</a>, there are lots of custom <a href="https://gohugo.io/content-management/shortcodes/">Hugo shortcodes</a> and there were footnotes powered by a nifty little Javascript library called <a href="https://littlefoot.js.org/">littlefoot.js</a>.</p>
<p>Now everything <em>was</em> fine and dandy.<br>
There are folks who <em>do</em> leave well enough alone. Their blogs stay up and running for years on end, held together with nothing more than spit and baling wire.<br>
Those folks aren’t me, sadly. Aditya keeps improving the theme and I really wanted the new shiny. <a href="https://github.com/adityatelange/hugo-PaperMod/releases/tag/v7.0">So I went and got it.</a><br>
And everything broke!<br>
I got weird artifacts. RSS broke. Fonts broke. Footnotes broke.<sup id="fnref:3"><a href="#fn:3" class="footnote-ref" role="doc-noteref">3</a></sup></p>
<p>I’ve managed to put everything back together, over the past week, and I <em>just</em> got footnotes working again yesterday.<br>
So a few notes to myself, on what to do, when I break it again.<sup id="fnref:4"><a href="#fn:4" class="footnote-ref" role="doc-noteref">4</a></sup><br>
Footnotes today, and the rest later …</p>
<p><hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

So here goes,</p>
<ul>
<li>The litlefoot.js repo has <a href="https://github.com/goblindegook/littlefoot#usage">excellent documentation</a>. That’s where you pulled everything from (for when you wonder, just <em>how</em> you figured all the CSS out)</li>
<li>You download a static copy with a <code>npm install --save littlefoot</code> and then stick it into Hugo’s static folder</li>
<li>Copy the <code>extend_head.html</code> from the theme’s <code>layout/partials</code> into your own. You should already have an <code>extend_footer.html</code> since you put in PaperMod’s hamburger stuff in there.</li>
<li>Adapt the <a href="https://github.com/goblindegook/littlefoot#usage-from-a-cdn">Usage from a CDN</a> step to directly access it from <code>/littlefoot/dist/…</code> instead of <a href="https://unpkg.com/">UNPKG</a>. Put the CSS link into your <code>extend_head.html</code> and the JS into <code>extend_footer.html</code></li>
<li>We want the footnotes to be numbers, rather than floating ellipses. So modify the default (blank) script call in <code>extend_footer.html</code>, to the stuff below. This is verbatim from the docs.</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-html" data-lang="html"><span style="display:flex;"><span>&lt;<span style="color:#f92672">script</span> <span style="color:#a6e22e">type</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;application/javascript&#34;</span>&gt;
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">littlefoot</span>.<span style="color:#a6e22e">littlefoot</span>(
</span></span><span style="display:flex;"><span>        {
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">buttonTemplate</span><span style="color:#f92672">:</span> <span style="color:#e6db74">`
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            &lt;button
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            aria-label=&#34;Footnote &lt;% number %&gt;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            class=&#34;littlefoot__button&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            id=&#34;&lt;% reference %&gt;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            title=&#34;See Footnote &lt;% number %&gt;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            /&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            &lt;% number %&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            &lt;/button&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            `</span>
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    )
</span></span><span style="display:flex;"><span>&lt;/<span style="color:#f92672">script</span>&gt;
</span></span></code></pre></div><ul>
<li>We want to style it a teensy bit, so those styles go into <code>extend_head.html</code>. For some reason, it does not pick the footnote styling correctly when you put stuff into your normal <code>assets/css/extended/</code> folder.</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-css" data-lang="css"><span style="display:flex;"><span><span style="color:#f92672">&lt;!</span><span style="color:#f92672">--Custom</span> <span style="color:#f92672">littlefoot</span> <span style="color:#f92672">styles--</span><span style="color:#f92672">&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;</span><span style="color:#f92672">style</span><span style="color:#f92672">&gt;</span>
</span></span><span style="display:flex;"><span>    .<span style="color:#a6e22e">littlefoot</span> {
</span></span><span style="display:flex;"><span>		<span style="color:#75715e">/*the --attributes come from the littlefoot.js docs*/</span>
</span></span><span style="display:flex;"><span>		<span style="color:#75715e">/*Change button background to something that works in both modes*/</span>
</span></span><span style="display:flex;"><span>        --button-background-color: <span style="color:#ae81ff">#666</span>; 
</span></span><span style="display:flex;"><span>		<span style="color:#75715e">/*Change padding to make the button rounder*/</span>
</span></span><span style="display:flex;"><span>        --button-padding: <span style="color:#ae81ff">0</span> <span style="color:#ae81ff">0.35</span><span style="color:#66d9ef">rem</span>;
</span></span><span style="display:flex;"><span>		<span style="color:#75715e">/*The footnote ought to be italicised*/</span>
</span></span><span style="display:flex;"><span>        --popover-font-style: <span style="color:#66d9ef">italic</span>;
</span></span><span style="display:flex;"><span>		<span style="color:#75715e">/*Make the popover work with my theme’s colour scheme*/</span>
</span></span><span style="display:flex;"><span>        --popover-background-color: <span style="color:#a6e22e">var</span>(<span style="color:#f92672">--</span>theme);
</span></span><span style="display:flex;"><span>        --popover-text-color: <span style="color:#a6e22e">var</span>(<span style="color:#f92672">--</span>primary);
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">/*the oldstyle numerals used everywhere else, don’t look good here
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">		Neither do they align properly in the box.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">		So switch them to normal*/</span>
</span></span><span style="display:flex;"><span>		<span style="color:#66d9ef">font-variant-numeric</span>: <span style="color:#66d9ef">normal</span>;
</span></span><span style="display:flex;"><span>		<span style="color:#75715e">/*Italic numerals for the footnotes*/</span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">font-style</span>: <span style="color:#66d9ef">italic</span>;
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    .<span style="color:#a6e22e">littlefoot__button</span> {
</span></span><span style="display:flex;"><span>		<span style="color:#75715e">/*very subjective. 
</span></span></span><span style="display:flex;"><span><span style="color:#75715e">		try to get the numerals centred as much as I can.*/</span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">line-height</span>: <span style="color:#ae81ff">1</span>;
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">vertical-align</span>: <span style="color:#66d9ef">middle</span><span style="color:#75715e">!important</span>;
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;/</span><span style="color:#f92672">style</span><span style="color:#f92672">&gt;</span>
</span></span></code></pre></div><hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

<p>Et voilà! Footnotes galore!</p>
<figure class="align-center ">
    <img loading="lazy" src="/images/2024/footnotes-2.png#center"
         alt="screenshot of a blogpost, with footnotes"/> 
</figure>

<figcaption style="font-style: italic; text-align: center;  font-size: 85%; color: var(--secondary)">
<p>It looks a little weird, a little  like a billie goat walked across my post, pooping pellets across the page.<sup id="fnref:5"><a href="#fn:5" class="footnote-ref" role="doc-noteref">5</a></sup><br>
But it is my kind of weird now.<br>
And I love it :)</p>
</figcaption>
<p><hr style='margin-left: auto; margin-right: auto; margin-bottom: 40px; margin-top: 50px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;'/>

Feedback on this post? Mail me at <a href="mailto:feedback@janusworx.com">feedback at this domain</a>
<br>

<br>

P.S. Subscribe to my <a href="https://janusworx.com/subscribe/">mailing list!</a><br>
Forward these posts and letters to your friends and get them to subscribe!<br>
P.P.S. Feed my <a href="https://www.amazon.in/hz/wishlist/ls/2QAUKHHAMOOVS?ref_=wl_share">insatiable reading habit.</a></p>
<hr>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>what we in the Mumbaiyya vulgar, would call, “Gaand mein keeda”.<br>
<em><strong>Please for the love of God, don’t look that up. Very not safe.</strong></em>&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:2">
<p>Heavily, as in heavily for a guy who doesn’t quite know what he’s doing.&#160;<a href="#fnref:2" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:3">
<p>All my fault obviously, with all the custom stuff. Nothing to do with the theme proper.&#160;<a href="#fnref:3" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:4">
<p>in the <em><strong>far, far, far,  future</strong></em>; future Jason! Not any time soon, you hear!&#160;<a href="#fnref:4" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:5">
<p>“Pooping pellets on the posted page”, Now there’s a tongue twister 😂&#160;<a href="#fnref:5" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded>
    </item>
  </channel>
</rss>
