#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!
#
[tantek]
jdp, btrem, [KevinMarks] continuing from #indieweb, in terms of editing protocols, now we have Micropub which does a MUCH better job than PUT or POST by itself for editing use-cases
#
[tantek]
the way forward now is to consider how would you use Micropub to edit any particular web page, whether its a post or some static resource or whatever
#
[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.
#
Loqi
[[tantek]] jdp, btrem, agreed with what [KevinMarks] said. Another way of looking at it is that PUT and POST were not really proven out with multiple interoperable implementations for "editing", and thus were prototype protocols at best, that now in practice se...
#
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
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.
#
Loqi
[Guillaume-Mayer] I tried the workaround but it didn't work for me. It seems that the js files in the _data directory are not loaded, not sure why. But putting the name of the layout in a json worked. In _data/layout.json: `"base.liquid"` If it can help someone.
#
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]
the put/editing conversation and the template conversation are related
#
[tantek]
in particular there is an impedance mismatch (or perhaps just asymmetry?) between what you as an author want to write/edit, and you as a publisher want to display to folks reading your website
#
[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
#
[tantek]
Micropub solves only *part* of the editing problem here, which is the "content" part, and doesn't do / say anything about how to create or edit the *templates* that are effectively part of the page as well as viewed by others
#
@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
#
[tantek]
I think this is why I want to pursue HTML native templating so we can avoid the need for another meta language
#
[tantek]
nevermind using comments or secondary markup punctuation 🙄
#
[KevinMarks]
MaVo was the closest to that.
#
[tantek]
I realize the last time this was tried it didn't go so well (HTML -> XML -> XSLT lol)
#
[KevinMarks]
The difficulty is in handling iteration and conditionals
#
[tantek]
that's a difficulty, I think even that "difficulty" is too in the weeds though
#
[KevinMarks]
I find the nunjucks/jinja2 approach useful in the same way PHP is
#
[tantek]
there's still the fundamental problem of the separation "content" from "template" which is invisible to the "reader"
#
[tantek]
though folks using social readers don't see templates so perhaps there is an opportunity there
#
[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
#
[tantek]
it's only JSON shaped for convenience of transport. it's actually HTML-shaped at its core
#
[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
#
[tantek]
btrem, part of my resistance is, why bother with templating at all? why not "just" focus on the content to begin with
#
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.
#
GWG
I think I just hit the weather motherload
#
GWG
aaronpk: I think I have something that may interest you
#
GWG
aaronpk: How far back does your weather data go?
#
GWG
2017?
#
GWG
I just found weather data for PDX station back to 1949
#
[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!
#
[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++
#
Loqi
shoesNsocks has 1 karma over the last year
#
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
#
[tantek]
I really appreciate working directly on the same file that is deployed
#
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.
#
[tantek]
pretty sure I don't have any "build step" in my site
#
Ruxton
its not about easy implementation, its about easy repetition
#
btrem
[tantek] do you manage new links/etc. "manually"?
#
[tantek]
new links? you mean in posts?
#
[tw2113_Slack_]
a hand rolled blog roll?
#
btrem
Ruxton Right. The idea is automate tasks when creating a new post.
#
[tantek]
I still don't understand the question
#
[tantek]
I do use an autolinker for my notes, is that what you mean?
#
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! :-)
#
[tantek]
what is autolink
#
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
#
[tantek]
autolinker is /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
#
aaronpk
Just gonna say, the source for OAuth.net is surprisingly refreshing to work on cause it's a bunch of old school php includes and no build process or anything
#
aaronpk
Over time I've made some of the pages a bit more dynamic, like making some of them generated from JSON files when I want all the pages to share a common nav hierarchy and such but most of the pages source files are mainly content
[snarfed] joined the channel
#
[snarfed]
aaronpk: re scraping instagram notifs, probably yes! i already had the profile and permalink scraping solid and well tested, including caching and comparing like/comment counts to minimize fetches, but otherwise i might have looked at it
[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/
#
[snarfed]
it now shows status info and lets you poke at it in the extension’s options page
#
[snarfed]
if it works ok, i’ll announce more widely
#
[snarfed]
thanks in advance!
jacky joined the channel
#
[xavierroy]
[snarfed] I see only instagram in the options?
#
sknebel
it's for instagram
#
[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
#
GWG
I am excited about finding a free historic weather data source. I need some advice though
#
GWG
Should I.. A..mirror some of thedata and build an API? Mirror what I need when I need it, or use their API and hope they don't discontinue it?
btrem joined the channel
#
GWG
The idea of adding backfilling weather to my old posts kept me up last night
#
GWG
I need someone to tell me I'm not going overboard
#
[jeremycherfas]
You’re not going overboard.
#
GWG
[jeremycherfas]: Do you think that, or just saying because I asked?
#
[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.
#
GWG
[jeremycherfas]: I was going to do something else next, but this is promising.
[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
#
GWG
[Raphael_Luckom]: It is actually, but they ask you don't overtax their service
#
GWG
It can be downloaded per station in gziped csv files
#
GWG
And I don't need every location
#
GWG
They have a json file that lists all the stations and their locations, I could do the ones I need first
#
[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
#
[snarfed]
raphaelluckom++ “hard drives on trucks”
#
Loqi
raphaelluckom has 1 karma over the last year
[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/
#
[tantek]
not sure where to capture it on the wiki though. (there is a strong WordPress criticism embedded in there, but that's just one example among many)
#
[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
#
Zegnat
getting stuff into the archive
#
GWG
Zegnat: First I need to use the data, I think
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?
#
Zegnat
Loqi stops at end of IRC messages, I think, [KevinMarks]. A linebreak in Slack translates your message to two separate messages on IRC.
#
Zegnat
seems to recall Loqi is IRC-native
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
#
[tantek]
what is markdown
#
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
#
[tantek]
[Raphael_Luckom] feel free to add any criticisms / missing features you know of
KartikPrabhu joined the channel
#
[tantek]
I do think there are lots of problems with md myself, not the least of which is that it lost it’s initial design principles.
[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.
#
[tantek]
md is not a build tool, it's an authoring syntax first and foremost
#
[tantek]
I don't think build tools are necessary per se. I blogged for ~6 years with 100% static HTML+CSS and it worked fine.
#
[tantek]
correction, 7
#
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
#
aaronpk
and "Bridgy couldn't translate likes for CJnGhHshG_R"
#
[snarfed]
aaronpk thanks! will look
#
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.
#
aaronpk
yay it's working now!
#
@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)