HNHacker News
TopNewBestAskShowJobs

kaushalmodi

353 karma · joined July 12, 2016

Loves Emacs and command-line utilities. You can find me by the same username on GitHub, Gitlab, reddit and Twitter.

Blog: https://scripter.co

* Few projects:

- Org-mode + Hugo: https://ox-hugo.scripter.co

- Eless (A Better less): https://eless.scripter.co

submissionscomments
kaushalmodi··on Top Open-Source Static Site Generators
I can answer to your comment with respect to Hugo.

> - Layout & Routing - Having "special" pages is usually impossible with "structured" SSGs (like Hugo). For example, say you want a page that's your portfolio and only contains posts with x and y tags and you want it to look different than normal pages.

Have you looked at the "layout" and "type" front-matter?

> Or for example archives, where "/year" = "/year/index.html" but also "/year/month/" = "/year/month/index.html" and "/year/month/postname" = "year/month/postname.index.html".

The "/foo/ = /foo/index.html" or pretty URLs is the default behavior in Hugo, which you can also disable.

Regarding archíves, there are quite a few examples in the Discourse forum. I believe I have seen people implement the yearly/monthly archives using taxonomies.

>- Sitemaps - I have videos on my blog and usually you want to add those to your sitemap properly. To do this I had to patch together a plugin to fetch the video info from the youtube api.

You can have a custom layout for your sitemap. Also, you can fetch data from an API during Hugo builds. Look at the Data feature.

> - Smart tags/embeds - Similarly I had to do something similar to fetch embeds from just the link like "[instagram]link[/instagram]". You have to do this with every provider you want, ugh, awful. Also means fighting the markdown converter you chose sometimes.

Using API like embed.ly and such, and can get such data in real time during the site builds. Alternatively, you can create JSON/TOML/YAML/CSV of all such data, save it to the data/ dirnl before the Hugo builds and use that instead if you want to save on thousands of API calls during each build. This is the same Data feature.

> - Images - I run a blog with lots of images and different views of those images, so I need to have them all in at least thumbnail size and the regular size, sometimes the original as well, but not always. I used to batch convert new ones by hand but that was a pain. I eventually patched together a metalsmith plugin for this to automate the conversion of originals to "regular" (max post width) and thumbnails but it needs improvement. Edit: And I forgot, actually adding the correct attributes needed for lazy-loading, etc, to the image tags was also a pain.

Hugo has inbuilt image processing for a while now. Look at Image Processing in docs. It can do automatic centering, cropping, resolution adjustment, etc during site builds. You can choose to do that afresh during each build, or reuse the altered images from the resources cache.

> - RSS, Most do not come equipped to handle rss, and available plugins are too simple (for routing that is, like having an rss feed per tag, per archive page, etc).

Hugo has this inbuilt. You can choose to have RSS for each "list" page like home page, tag page, category page, etc., and even for each individual post if you like. All of that is configurable.

> - Layout Language - Depends on the SSG, most allow choosing or these days are super flexible (e.g. Nuxt) but those that don't and just use one template language, argh! Template languages like handlebars are just not flexible enough. This was the easiest to fix though. I just use ejs now, basically allows any valid javascript, love it.

Yes, Hugo mainly supports Go Templating. (And I don't have any complaints against that :))

kaushalmodi··on Top Open-Source Static Site Generators
> Biggest problem for me is the template engine and its incoherence, followed by poor documentation.

What's wrong with the template engine? Also, before you switch to a different SSG, bring up the pain points in the documentation on the Hugo Discourse forum or as an issue in the HugoDocs GitHub repo. Please.

> Also the lack of flexibility in content organization

An example would help. What part of the content organization is inflexible. Of course there are some rules, else how will the SSG find the content consistently? But an example would help. (Atleast all the files don't have to be prefixed with date stamps.)

> I started using Hugo thinking I would not need to know Golang, but could use it as a way of learning the language. I'm starting to realize it's probably better to do it the other way around, as without knowing Golang much of Hugo seems unaccessible or very challenging at the least.

Examples please. What part is inaccessible? I have been using Hugo for 1+ year, and I am still going string on not learning Go (learning Nim instead, it's awesome!)

> This doesn't fit my needs, we are several that interact with the static sites and getting the whole team productive with it is too expensive.

Typically when deploying SSG for a team, most of the team just contributes to the content (Markdown, for example), and few few folks handle the design of the site layout. So everyone doesnt even need to learn Go templates.

kaushalmodi··on Top Open-Source Static Site Generators
There is 0 value. At some point there was some value, but not after the launch of services like Netlify.

In my experience, Netlify.com is 1000x better.

HTTPS, smooth integration with any SSG (including Hugo), any of the big git repos (GitHub, Gitlab, Bitbucket), great customer service, all for free.

kaushalmodi··on Top Open-Source Static Site Generators
I am not a web developer.

I have been following Hugo development, and I see that a lot of new features are getting added. But if it's something that I don't care about (i18n, SASS support, archetypes update, etc) I just ignore and don't use the new features.

I'm interested in knowing the overhead you are facing in keeping up. I just read the Release notes, and often find something I really wanted in the next update (if not everything in that update).

Overall Hugo development is quite conservative about introducing backward incompatible changes. They do happen, but very rarely (sign of progress). I remember the last time that happened about a year back when Page Bundles got introduced.

kaushalmodi··on Top Open-Source Static Site Generators
> Do you come from a Go background?

This is not directed to me but I'd like to chime in and say that one doesn't need to know Go language to write Hugo templates. I appreciate Go Templates even without knowing Go.

It's quite simple:

- If you don't want to learn the templating for a static site generator, use one of the readymade themes.

- If you want to tinker with the themes or create your own themes, learn the templating language. There's no magic potion.

kaushalmodi··on Top Open-Source Static Site Generators
> awful awful Go template engine.

I find it hard to understand what's so awful about Go Templates. Can you paste few examples of Go templating that you didn't like?

kaushalmodi··on Top Open-Source Static Site Generators
> tens of hours you will spend debugging its weirdness and magic.

That's a very surprising comment, without any detail. Can you elaborate on what you found surprising and magical?

> How variables work is impossible to understand. So is creating new layouts.

Again, some details would help understand the real problem.

[ It's agreed that you need to learn any new thing you'd like to use. ]

I have used Hugo for more than a year now, and I don't see any reason to move away from it, as it is awesome! Once you understand Go Templates (this is awesome too. Coming from Emacs-Lisp, I can associate the Go Template syntax with it in some ways :D).

> The speed of generation doesn't seem much of an added advantage since you're gonna do it only once anyway.

I publish/update my site about a dozen times on days when I am updating my notes (which I publish to my site). It's a real boon to be able to save the content file, glance to the browser, and see it updated within that time. There is no exaggeration; it's that fast!

It's difficult to take your complaints seriously if you update your site "only once"!

> It's hard to know why would anyone make such weird design choices to solve a problem that has an easy, known solution. Am I trivializing?

Which weird design choice? Which easy solution?

kaushalmodi··on Google is discontinuing Inbox
I don't like incorrect unread counts lying around.

I then cannot distinguish between truly unread emails and the emails that I swiped as Done in Inbox, but still left unread in Gmail.

kaushalmodi··on Google is discontinuing Inbox
These are really unfortunate news! :(

My stress level just went up after opening gmail.com after few years since I switched to Inbox.

Being used to just swiping emails that I didn't need to attend, I didn't realize they were still in "unread" status.

Now when I opened Gmail, I see:

    Social          190
    Updates       4,856
    Forums        3,329
    Promotions    4,214
The worst part is that I cannot see which of those "Unread" emails are pinned in Inbox.

And.. we cannot Pin emails in Gmail the same way as in Inbox :( [I have already read the "Pin emails" section in https://support.google.com/inbox/answer/9117840, but starring/labeling/searching doesn't give the convenience that Inbox pinning did.]

I'll also miss all the rich email rendering of emails like shipping tracking, flight tickets, appointments, etc.

Alas..

---

Update: And of course Google would discontinue Inbox. Inbox did not have ads, but Gmail has freaking ads!

kaushalmodi··on Pandoc
It sounded like a rhetorical question, and based on the context that you use it for a lot of things, I sensed a bit on excitement there too, and thus the exclamation.. like "Isn't that awesome‽".
kaushalmodi··on Pandoc
I found it confusing too. You were supposed to use interrobangs (‽) instead of "?" :)
kaushalmodi··on Show HN: How privacy-friendly is your site?
@andersju Thanks for making this web site. I have used this site in the past, and it helped me make my Hugo generated static site more secure.

Your site is very informative, and easy even for a non-webdev like me to grasp.

https://webbkoll.dataskydd.net/en/results?url=http%3A%2F%2Fs...

kaushalmodi··on Ask HN: How do you blog in 2018?
I write my posts[0] in Org mode[1], export them to Markdown using ox-hugo[2], publish to HTML using Hugo[3], and deploy the site over HTTPS using Netlify[4].

[0]: https://scripter.co

[1]: https://orgmode.org/

[2]: https://ox-hugo.scripter.co/

[3]: https://gohugo.io/

[4]: https://www.netlify.com/

kaushalmodi··on Um – Create your own man pages so you can remember how to do stuff
Better search and better organization of the document (TOC, index search, etc.). And reading/searching Info manuals is a lot more convenient in Emacs Info-mode.
kaushalmodi··on Python Fire – Generates CLIs from any Python object
I've been using a similar library in Nim called cligen[0]. Like Fire, it infers the CLI long form/short form switches from the arguments of the function it is linking to. Follow the repo link for examples.

[0]: https://github.com/c-blake/cligen

kaushalmodi··on Leo Editor
> imagine keeping code in Emacs's Org mode and being able to compile it.

Org mode already does that using Org Babel. I use it to take "code notes" (code blocks with their evaluated/compiled outputs with notes) for Python [0], Nim[0,1], Awk [2], PlantUML[3], etc.

[0]: https://scripter.co/notes/string-fns-nim-vs-python/

[1]: https://scripter.co/notes/nim/

[2]: https://scripter.co/notes/awk/

[3]: https://scripter.co/notes/plantuml/

kaushalmodi··on Punctuation that failed to make its mark
Iosevka font has an awesome looking Interrobang. See https://be5invis.github.io/Iosevka/specimen.html (scroll down to the U+2030 row; ‽ is U+203d).

I think that other fonts should follow that example too.

Until then, as I anyways use subsetted fonts on my blog, I can easily specify the font to use for the ‽ glyph.

kaushalmodi··on Punctuation that failed to make its mark
This article is from 2015.

So does the posting of this have anything to do with the recent Interrobang episode on the 99% Invisible podcast‽

(99pi is an awesome podcast btw!).

After listening to this episode, I even added a binding to the "C-x 8" map in Emacs[0]. This key map is mainly used for inserting various Unicode characters. So now in my Emacs, "C-x 8 ?" inserts ‽.

[0]: https://github.com/kaushalmodi/.emacs.d/commit/a70dd6b7c39f0...

kaushalmodi··on Ask HN: What are the best ways to build a single-page site?
If looking for static site (single page or not), Hugo (https://gohugo.io) + Netlify.com work great!

I was able to easily churn out a single-page "for rent" site using the Hugo Creative theme[0].

[0]: https://github.com/digitalcraftsman/hugo-creative-theme

kaushalmodi··on Visual Cheatsheet for CSS Grid Layout
> You are right, but critically it isn't supported by IE 11

This has always bugged me. Why does IE always lag behind in such CSS features? What kind of politics is this? Or is it that Microsoft does not have a big or smart enough browser team that can bring the IE/Edge features at par with Firefox/Chrome?

I've been so pissed off by this that I've started a micro-revolution by not caring if my blog renders well on IE/Edge. IE is pain in meeting compatibility with the CSP headers too. Hopefully more people start doing this so that people are forced to move to a better browser than IE.

kaushalmodi··on Blogging with Emacs org-mode
I think it is this[1], right? I think you should update the Worg: Org Blog Wiki[2] with it if you want more people to discover/use it.

I liked the thoroughness of "why I made this project" in its README.

[1]: https://github.com/ctindall/org-blog

[2]: https://orgmode.org/worg/org-blog-wiki.html

kaushalmodi··on Hyperpolyglot: Lisp
In the markup languages section, it's missing a lot of Org mode snippets. I'll see if there a way to contribute to that page. It's quite outdated.
kaushalmodi··on Blogging with Emacs org-mode
> Maybe the other options are better, I don't know. Would definitely be interested in hearing people's personal experiences.

If you are open to trying out Hugo, see if my above comment[1] regarding ox-hugo.

[1]: https://news.ycombinator.com/item?id=17721272

kaushalmodi··on Blogging with Emacs org-mode
I developed the ox-hugo[1] Emacs package, which allows exporting multiple posts (even the website structural pages like Home page, About page, etc.) from a single Org file.

So here's the elevator pitch:

- ox-hugo is an Emacs package that exports from Org mode to Markdown format that's compatible with Hugo (https://gohugo.io) / Blackfriday + automagically converts natural* Org metadata to TOML/YAML front-matter.

- To understand what I mean by "natural" Org metadata, see this table[2].

- ox-hugo works with Hugo. I let each tool to do what they are best at:

(i) Org mode deals with the rich markup (Org macros, INCLUDE, TOC, keywords, Org Babel, NoWeb, property/tag inheritance, etc.) and Emacs/Elisp processing, and

(ii) Hugo deals with all the "Web stuff" in super-fast fashion (roughly 500 pages in less than a second [depends on your theme efficiency too]): Markdown->HTML conversion, generation of list pages, taxonomy pages, RSS/Atom/JF2/.. feeds, minification, cache busting, page generation using JSON/TOML/.. data, etc.

- I prefer having most of the posts be exported from a single Org file (my blog[6] source[3]). So ox-hugo definitely supports that. It also supports the conventional flow of exporting each Org file to a single post too (I use that style too, for my "notes" posts).

- The ox-hugo doc site[1] is dog-fooded by ox-hugo itself. Here's the single Org file[4] that holds the content for the entire site.

--> Here are few Real World Examples[5] of people using ox-hugo + Hugo.

== Refs ==

[1]: https://ox-hugo.scripter.co/

[2]: https://ox-hugo.scripter.co/doc/org-meta-data-to-hugo-front-...

[3]: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/blob/ma...

[4]: https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master...

[5]: https://ox-hugo.scripter.co/doc/examples/

[6]: https://scripter.co/

PS: Your user name sounds a bit familiar. So I apologize if I have already mentioned ox-hugo to you.

kaushalmodi··on Nim partners with Status.im
Those are awesome news! I'm glad to see "improvement of nimsuggest and LSP development" in the suggestions :D
kaushalmodi··on GitLab 11.1 released with security dashboards and enhanced code search
I wished this update came with gitlab.com-wide project search. But looks like the "improved search" still didn't include that.

Github-wide search is great! I wish Gitlab had something like that. That's one of the things that's stopping me from switching 100% to Gitlab.

The site-wide search on GitHub allows me to explore code snippets, learn how someone else uses the "foo" syntax, see the trending repos in a given language, and so much more.

kaushalmodi··on Show HN: A command-line flat-file note management app in Python 3
For Emacs users, if you haven't yet checked out, look at the robust and mature Org mode and Org Capture.
kaushalmodi··on Keeping a plaintext “did” file
Emacs Org mode fits that requirement nicely.

Org mode (a plain text format ljke Markdown, but much more than that) files export easily to Markdown, HTML, tex/PDF, and multitude of other formats using Emacs itself or even Pandoc.

My site (in my HN profile), for example contains text, images, etc. The content source is in Org mode.

kaushalmodi··on Toml: Tom's Obvious, Minimal Language
Here's the TOML parser in Nim language: https://github.com/NimParsers/parsetoml.

It works great based on my small amount of testing, and TOML is awesome! I wish more people start using it.

kaushalmodi··on Bringing Blogging to the Fediverse
Have to looked into Webmentions? I use those my blog, with backfeed from Twitter. So I end up with few pleasant surprise Webmentions too :)

So far I haven't yet (hope that didn't change) needed to do any manual spam cleanup. If I ever need to, I hope that it's as simple as deleting such mentions from WebMention.io.

← PreviousPage 2 of 8Next →