#dev 2021-01-05
2021-01-05 UTC
DanC joined the channel
# btrem Cripes, I am using nunjucks in VS code, and need template writing support. So I searched marketplace, and found 8 different modules. Which one do I choose?
# btrem I've found this several times, e.g., looking for liquid template support.
# [KevinMarks] Um I don't know which one I picked
# btrem I tried to figure out which was better, and wound up just picking the one at the top.
# btrem Very scientific of me!
# [KevinMarks] Yes, because it defines the structure better. A lot of existing editors do odd things to the html in the cause of wysiwyg.
# btrem I wasn't arguing that PUT was a good protocol. Only that its existence in HTTP 1.0 suggests that there was a thought to giving a client the ability to create a web page.
# [KevinMarks] Or they use something else as the editable form, some wiki text or markdown variant, or another rich text structure
# [KevinMarks] Which means that round tripping is hard
# btrem I find it hard to remember which format to use -- md or wiki -- when I'm using e.g. the microformats wiki. :/
# btrem https://chat.indieweb.org/2021-01-05/1609808170025400 [tantek] I didn't think PUT was intended for changing a resource. But yes, there were very few implementations of PUT, which probably says all that needs to be said.
# btrem I don't know much about micropub, and I'm too busy trying to figure out 11ty and nunjucks. As is so often the case, it's always way more work and way more time than one thinks.
# btrem Oh for cripes sakes. Any 11ty users here? How/where do I specify a default layout/template to use so I don't have to define it for each page?
# btrem It is nothing short of maddening to find scores of examples of how to specify it for a subdirectory, but not for the whole site. @#!@#!
# btrem A github issues queue provides the solution, I think. :)
# shoesNsocks btrem: I only have a few files at the root, so I put a `layout: mainlayout.njk` in each, but I'm interested in the answer if you find it
# btrem In the data directory, typically _dir though I have changed it, you add layout.js (*not* layout.json).
# btrem damnit, hit enter by mistake.
# Loqi [KyleMit] The challenge is, when using a [global data object](https://www.11ty.dev/docs/data-global/) in the `_data` directory, the returned values are set on a property with the same name as the file
So if you have the following file:
`_data/data.json`
...
# btrem In the data directory, typically _dir though I have changed it, you add layout.js (*not* layout.json). In that file, add the line
# btrem module.exports = "default.nkj"
# btrem or whatever your default layout/template is.
# btrem hth
# shoesNsocks ah!
# shoesNsocks I was just starting to explore the idea of putting 'root-level' files in a subdirectory but coming up with some sort of trick to modify the permalink, but that's really just moving the problem from one variable to another. Glad there's a way
# btrem shoesNsocks I'm not sure if that's a solution or not. Now I'm getting a new error. 11ty can't find the site variable, defined in data/site.json. So maybe layout.js blocks json files? Grrrrr.
# btrem How can you create an ssg with templating, and not provide a straightforward way to specify a default template?
# btrem shoesNsocks: might be a different problem. It looks like you can't use variables inside
{%if %}
tags. Is that right?# shoesNsocks I just read that issues thread, and the suggestion at the tail end seems to have worked for me.
# shoesNsocks I created `_data/layout.json` which contains "../_includes/mainlayout.njk" and a bare markdown file in my root dir used that template.
# shoesNsocks that doesn't even look like valid JSON? Just a relative path in quotes? But it works, on my setup.
# [tantek] if we had actual GET/PUT symmetry, you would 100% edit your content exactly as it is displayed, but in practice as we seem to implicitly accept, no one actually wants that, or rather, no one actually wants to edit their posts, content etc in the context of all the other crap that their template display on their page
# @kaushikgopal ↩️ I've also been looking at Webmentions which is an open standard (http://webmention.io) + something like Bridgy - which seems to give the best of both of these worlds. (twitter.com/_/status/1346276600208244736)
# [KevinMarks] There's 2 kinds of if in nunjucks
# [KevinMarks] MaVo was the closest to that.
# [KevinMarks] The difficulty is in handling iteration and conditionals
# [KevinMarks] I find the nunjucks/jinja2 approach useful in the same way PHP is
# [KevinMarks] But it's a but more direct - you have a json shaped content that the template has access to and can use iterators and conditionals on
# [KevinMarks] I meant in the nunjucks/jinja2 context.
# shoesNsocks @btrem I made a simplified repo where that default-template solution seems to work (https://github.com/shoesandsocks/eleventy-default-template-example), but I can imagine more complex projects where it wouldn't. Particularly with non-default-name folders, etc (from 11ty's point of view.)
# btrem shoesNsocks: the problem with a novice like me is there are too many confounding factors. I tried to use a ternary statement with a variable, which it seems you can't do. When I removed it, the default template started working again.
# btrem [tantek] It sounds like micropub is something for me to look into, then. But not now. As you can see from my exchange with shoesNsocks, I'm struggling with a new template language and build tool. That's enough for me right now.
# shoesNsocks @btrem I started fooling with 11ty with the advantage of a blank slate -- beyond some *very* rudimentary jade/pug in a "teach yourself Node/Express" thing a few years ago, I've never used templating before. I've just been tweaking Nunjucks examples I see elsewhere... 😆
# btrem shoesNsocks Me too. It's actually very similar to jinja. *Very* similar. I probably never tried ternary with jinja. Once I realized that that was causing the error, it sort of made sense, actually. The syntax of ternary makes the parser think the variable is a(n unknown) tag, IYSWIM.
# btrem Its similarity to jinja is pretty nice, because extends works the same way.
# btrem shoesNsocks: I swear jinja had a way to define a block, and repeat the block in the same template, without resorting to includes. Do you know if there's a way to do that?
gbmor joined the channel
# btrem Because DRY. :)
ShadowKyogre joined the channel
# btrem I don't know where I said this (here? #indieweb channel?) but I'm switching from simple html + css to 11ty because I don't want to create and manage blog posts/links/navigations. It's sure to break because I'll forget something. 11ty seems like a good compromise between managing that stuff, but allowing me to write in markdown if I want to keep it
# btrem simple.
# btrem And, hopefully, not lock me into a url structure that won't work if I ever decide to switch.
# @kevinmarks ↩️ Webmentions with http://brid.gy for tweets and http://commentpara.de for free form? (twitter.com/_/status/1346294374288777218)
# @kevinmarks ↩️ Webmentions with http://brid.gy for tweets and http://commentpara.de for free form? (twitter.com/_/status/1346294374288777218)
# [KevinMarks] That second if expression style is what you can use instead of a ternary a lot of the time
# [KevinMarks]
{{ "true" if foo else "false" }}
# [KevinMarks] Which is clearer than a ternary for the simpler case
# btrem [KevinMarks] That's actually what I was trying to do:
{% site.name if foo else <a>site.name</a> %}
# btrem but nunjucks thought I was writing a nunjucks tag
{% site.name %}
and there is no such tag. That's what I think was happening, anyways.# lahacker does anyone know how to reference operating-system colors from within css?
nickodd joined the channel
# lahacker oh it was "operating system" that i was missing from google searches
# lahacker found it
# btrem shoesNsocks: can I turn off template processing on a per file basis? I dunno, like layout: none in the yaml prologue?
# shoesNsocks @btrem hm, never seen that use-case (but I'd never seen the default-template-applied-to-project-root either).
# btrem shoesNsocks bummer. Ok, I'll have to figure out another way. I have demo .html files that I don't want processed like the rest of the site. They are minimal. I'll just make a blank template, I think.
# shoesNsocks I just tested that idea. Template that's just <html>
{{ content }}
</html> and specifically name it in frontmatter. seems to be ok# shoesNsocks (you don't want to ignore those files altogether, in an `.eleventyignore`, right? just not have them pass thru template b/c they're already "full" html?)
# btrem Correct, I want to pass them through. Which doesn't work, because even when I specify an html file in the passthrough config, 11ty still processes it. That is, it passes it through and creates a separate processed copy. Very annoying.
# btrem [tantek] Yes, I see what you mean by "why bother templating at all". ;-)
# shoesNsocks @btrem random dumb question - what happens if you put an HTML file in .eleventyignore AND explicitly call passthrough on it, in the 11ty config??
# btrem Stupid frameworks/build systems/etc. :-<
# btrem @shoesNsocks I'm about to find out!
# shoesNsocks ha!
# [KevinMarks] It's
{{ }} for an expression but {* *}
for control# [KevinMarks] So
{* if foo **} {{site.name}} {** else *} <a>{{site.name}} </a>{** endif *}
# btrem [KevinMarks] So even though it's an if statement, I use
{{}}
because it's ternary?# [KevinMarks] With {{ it's an expression
# btrem Whoa, that's odd looking statement. The double * looks like the kind of thing that'll bite me later on.
# [KevinMarks]
{{ site.name if foo else "<a>" + site.name + "</a>" }}
# [KevinMarks] (I am doing this from memory not in an editor)
# @soMelanieSaid ↩️ I do use Webmentions for my main personal site, looking for something a bit more friendly to a “non-technical” audience (used to inline comment forms) since this is for my fiber crafts blog. Thank you though! (twitter.com/_/status/1346310701460033536)
# btrem [KevinMarks] thanks I'll try that and fiddle around to see if I can get it to work.
# [KevinMarks] Oh, I typoed
{* else *}
# aaronpk [snarfed] just had a thought... if bridgy is using a browser extension for Instagram now can't it look at the notifications page to get notifications for all photos with recent likes/comments instead of polling individual photos? (Or maybe that's how it already works and I just haven't looked into it actually 🙊)
# btrem shoesNsocks: your solution "put an HTML file in .eleventyignore AND explicitly call passthrough on it" works!
# btrem shoesNsocks++
# btrem 11ty--
# btrem That's supposed to be 1 negative karma for 11ty! For making me go through that rigamaroll to pass an html file through! :-p
[tw2113_Slack_] joined the channel
# [tw2113_Slack_] i thought build tools were meant to make lives easier
# btrem That's the idea. But whenever you're learning a new one, there's always a curve. Also, there's pretty much always some task or other that becomes difficult or worse because of the build tool.
# btrem [tantek] do you manage new links/etc. "manually"?
# [tw2113_Slack_] a hand rolled blog roll?
# btrem Ruxton Right. The idea is automate tasks when creating a new post.
# btrem [tantek] Maybe.
# btrem I don't know what an autolinker is.
# btrem What is autolinker?
# Loqi It looks like we don't have a page for "autolinker" yet. Would you like to create it? (Or just say "autolinker is ____", a sentence describing the term)
# btrem Oh well, had to try! :-)
# Loqi An autolink is a hyperlink that was automatically added to some text to link that text to an obvious or useful destination, like hyperlinking a URL in plaintext to the URL itself, linking hashtags to search results, and @-names to their profile pages https://indieweb.org/autolink
# btrem Oh damn it. You stole my thunder.
# btrem I was going to use loqi for the first time. Fail.
# btrem [tantek] ATM, my site is just a handful of static pages. I have a couple of articles published elsewhere (e.g., GitHub pages). That's silly. I *have* a domain and website, I should *use* them.
# btrem But if I start writing articles on a semi-regular basis, I don't want to manage changing my nav, adding links to new posts, etc.
# btrem [tantek] So not autolink. I can achieve that with markdown pretty easily.
# btrem Ok, thanks to everyone who helped me today. It's time for dinner and no more coding.
btrem left the channel
[snarfed] joined the channel
[xavierroy] joined the channel
# [snarfed] [gRegorLove] [chrisaldrich] i’ve made some significant changes to the bridgy browser extension, mind upgrading? you may need to remove and reinstall. https://chrome.google.com/webstore/detail/bridgy/lcpeamdhminbbjdfjbpmhgjgliaknflj , https://addons.mozilla.org/en-US/firefox/addon/bridgy/
jacky joined the channel
# [xavierroy] [snarfed] I see only instagram in the options?
# [xavierroy] Thought it was for every platform that bridgy supports!
# @ki_run ↩️ +1 for webmentions. It is one of a family of protocols (called social web or something like that) and my understanding is that it also allows to comment or share to feed without being tied to a particular service. ActivityPub is the most relevant protocol (twitter.com/_/status/1346353967874367488)
djmoch and schmudde joined the channel; nickodd left the channel
# @sockeqwe ↩️ Thanks! Webmentions sounds indeed very interesting. Will give it a try (twitter.com/_/status/1346390452442984448)
strugee, hoschi, gxt, [KevinMarks], stacktrust, jamietanna, [Roy_Mosby] and ShadowKyogre joined the channel; ShadowKyogre left the channel
# @mxbck ✏️ Today I learned how to use @Netlify build plugins to have folders stick around between builds, and I'm using it to cache webmentions for my @eleven_ty site. Here's how:
https://mxb.dev/blog/persistent-build-folders-netlify/ (twitter.com/_/status/1346467875964424205)
lanodan, hoschi, KartikPrabhu, [Roy_Mosby] and [jeremycherfas] joined the channel; ShadowKyogre left the channel
btrem joined the channel
# [jeremycherfas] You’re not going overboard.
# [jeremycherfas] But just in case, tie yourself to a railing.
# [jeremycherfas] As you said a couple of days ago, do what pleases and interests you.
# [jeremycherfas] I’d be tempted to save the data locally, if it were me.
[Raphael_Luckom] joined the channel
# [Raphael_Luckom] If I was looking at that much historical data behind an API and I was thinking about mirroring it, I might check to see if it's available in bulk for download. If you think you might want _all_ the data, scraping might be an inefficient way to get it. And if there's a more efficient bulk way, that might make wholesale download more appealing
# [Raphael_Luckom] "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway." - https://en.wikiquote.org/wiki/Andrew_S._Tanenbaum
[snarfed] joined the channel
[tantek] joined the channel
# [tantek] I feel this very strongly: "The best tool is no tool, the best build step is no build step, the best update is no update. HTML gives us all that, and more." https://blog.steren.fr/2020/my-stack-will-outlive-yours/
# [Raphael_Luckom] yep, everyone's got preferences!
[schmarty] joined the channel
# Zegnat GWG: if it is *a lot* of CSVs where i feels like even bulk downloading might be you overtaxing them, maybe get in touch with them and offer your services for getting it all published on the internet archive? That seems like a great place for this historical data, and then they can point there if others are interested in bulk download? You can always refer to all the indieweb video archiving you have been doing as prior work with
gRegorLove and [KevinMarks] joined the channel
# [KevinMarks] Tantek, I put it under manual until it hurts but maybe we need a page for html advocacy.
# [KevinMarks] What is longevity?
# Loqi Longevity is the goal of keeping your data as future-friendly and future-proof as possible; it is one of the indieweb principles https://indieweb.org/longevity
# [KevinMarks] That page needs Ian's quote about html5 too
# [KevinMarks] longevity << “I decided that for the sake of our future generations we should document exactly how to process today's documents, so that when they look back, they can still reimplement HTML browsers and get our data back”
# Loqi ok, I added "“I decided that for the sake of our future generations we should document exactly how to process today's documents, so that when they look back, they can still reimplement HTML browsers and get our data back”" to the "See Also" section of /longevity https://indieweb.org/wiki/index.php?diff=74173&oldid=73213
[tw2113_Slack_] joined the channel
# [KevinMarks] Hm, does loqi stop at newlines?
# [KevinMarks] longevity << Ian Hickson, 2007 http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2007-February/009517.html
# Loqi ok, I added "Ian Hickson, 2007 http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2007-February/009517.html" to the "See Also" section of /longevity https://indieweb.org/wiki/index.php?diff=74174&oldid=74173
ShadowKyogre joined the channel
# btrem https://chat.indieweb.org/dev/2021-01-05/1609872708704900 I appreciate the idea of keeping things simple. And that sometimes the solution just introduces another problem. But html by itself does not necessarily provide the flexibility needed to publish web sites efficiently. Happy to provide personal examples, though I don't think anyone needs
# btrem them.
# Loqi [[tantek]] I feel this very strongly: "The best tool is no tool, the best build step is no build step, the best update is no update. HTML gives us all that, and more." https://blog.steren.fr/2020/my-stack-will-outlive-yours/
hoschi and ShadowKyogre joined the channel; ShadowKyogre left the channel
# [KevinMarks] Well, the other half of that is to use microformats in your templates so it is easier to extract the structure from the html if that's all that survives
[frank] and [Raphael_Luckom] joined the channel
# [Raphael_Luckom] Every time I use markdown for something substantial, like a blog, I find that I want at least 25% more features than it actually has--better size / positioning for images, ability to add classes to things, etc. It's interesting how many times the "document layout" problem has been solved in different ways--TeX, HTML, postscript, markdown. And they've all got different values and uses.
# [Raphael_Luckom] md is still my favorite, but I expect to extend a parser myself, at which point I'll be stuck on a frankenstein flavor for...how long have they been working on TeX now?
# [KevinMarks] You can embed html in markdown, that's part of the point. You shouldn't need to come up with even more convoluted syntax if it's easier to do in html
# [Raphael_Luckom] the problem, as btrem noted in #microformats, is that sometimes you want to modify the html that's generated from the markdown, rather than embedding extra html
ShadowKyogre left the channel
# btrem Yep. That's why I think it's sort of facile to say the only build tools we need are html + css. Or markdown.
# btrem I've lost plenty of time retrofitting documents to know that that just isn't always the case.
# [Raphael_Luckom] everyone has a way they like to do it. Almost everyone thinks that there is no one "right" way. And then goes on to explain why their way is the one right way.
KartikPrabhu joined the channel
# btrem :-D
jamietanna and [tantek] joined the channel
# Loqi Markdown is a way of writing and interpreting plain text so that it can optionally be converted to more explicitly meaningful or richly styled text like HTML https://indieweb.org/markdown
KartikPrabhu joined the channel
[Roy_Mosby], [snarfed] and btrem joined the channel
# btrem [tantek] I don't think the point is that markdown should be subject to more criticism. It's that sometimes build tools outside of markdown (or html + css) are useful. Necessary, even. That's all.
# btrem I'm going to use markdown a bit more often for my site when it becomes easier to post articles. Soon, I hope.
# aaronpk [snarfed]: i'm getting some errors in the chrome extension logs: instagram.js:187 POST https://brid.gy/instagram/browser/likes?id=tag:instagram.com,2013:2478978784175615953_1500881&token=... 400
# btrem [tantek] md is not a build tool. That we agree on. As I've said, repeatedly: sometimes, md/html+css is not always appropriate for publishing. Not for everyone. It's good that it worked for you, but I've had situations where writing long html tables and creating long indexes of pages would have been a nightmare.
# btrem So I used a build tool. Having been down that road, I've decided, in light of my decision to publish articles, to learn a new build tool. I'm going with 11ty, unless it proves too difficult. So far, it seems reasonable.
# @JamieTanna ↩️ I allow interactions with my site using the Webmention standard, which allows folks to reply ie from their own website as well as anonymous comments via https://commentpara.de (https://www.jvt.me/mf2/2021/01/lcnv9/) (twitter.com/_/status/1346600318675648515)