Categories: sharing » writing » blogging

RSS - Atom - Subscribe via email

This is a test post from Org Mode to 11ty

| blogging, org, emacs

At the moment, my Org file needs to be in the proper content directory. I'm planning to copy the way ox-hugo allows me to export to a different directory and export filename. In the meantime, this is a start.

;;; ox-11ty.el --- Eleventy export for Emacs Org Mode  -*- lexical-binding: t -*-

;; Copyright (C) 2021 Sacha Chua

;; Author: Sacha Chua <sacha@sachachua.com>
;; Version: 2.17.0
;; Package-Requires: ((emacs "27"))
;; Keywords: org, eleventy, 11ty
;; Homepage: https://github.com/sachac/ox-11ty

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; A very rough starting point for exporting to 11ty from Org Mode.
;;

;;; Code:

(require 'ox-html)

(defun org-11ty-template (contents info)
  (let* ((date (org-export-data (plist-get info :date) info))
         (title (org-export-data (plist-get info :title) info))
         (permalink (org-export-data (plist-get info :permalink) info))
         (categories (org-export-data (plist-get info :categories) info))
         (collections (org-export-data (plist-get info :collections) info))
         (front-matter (json-encode
                        (list :permalink permalink
                              :date date
                              :title title
                              :categories (split-string categories)
                              :tags (split-string collections)))))
    (format
     "module.exports = class {
  data() {
    return %s;
  }
  render() {
    return %s;
  }
}"
     front-matter
     (json-encode-string contents))))

(defun org-11ty-export-as-11ty (&optional async subtreep visible-only body-only ext-plist)
  "Export current buffer as 11ty file."
  (interactive)
  (org-export-to-buffer '11ty "*org 11ty export*" async subtreep visible-only body-only ext-plist))

(defun org-11ty-export-to-11ty (&optional async subtreep visible-only body-only ext-plist)
  (interactive)
  (let* ((info
          (org-combine-plists
           (org-export--get-export-attributes '11ty subtreep visible-only)
           (org-export--get-buffer-attributes)
           (org-export-get-environment '11ty subtreep)))
         (base-file-name (concat (or
                                  (and (plist-get info :file-name)
                                       (if (string= (file-name-base (plist-get info :file-name)) "")
                                           (concat (plist-get info :file-name) "index")
                                         (plist-get info :file-name)))
                                  (org-export-output-file-name "" subtreep))
                                 ".11ty.js"))
         (file
          (if (plist-get info :base-dir)
              (expand-file-name base-file-name (plist-get info :base-dir))
            base-file-name)))
    (when (file-name-directory file)
      (make-directory (file-name-directory file) :parents))
    (org-export-to-file '11ty file
      async subtreep visible-only body-only ext-plist)))

(org-export-define-derived-backend '11ty 'html
  :menu-entry
  '(?1 "Export to 11ty JS"
       ((?b "As buffer" org-11ty-export-as-11ty) 
        (?1 "To file" org-11ty-export-to-11ty)))
  :translate-alist
  '((template . org-11ty-template))
  :options-alist
  '((:permalink "PERMALINK" nil nil)
    (:categories "CATEGORIES" nil 'split)
    (:base-dir "ELEVENTY_BASE_DIR" nil nil)
    (:file-name "FILE_NAME" nil nil)
    (:collections "ELEVENTY_COLLECTIONS" nil 'split)))

;;; ox-11ty.el ends here

https://github.com/sachac/ox-11ty/

View or add comments

Statically generating my blog with Eleventy

| blogging

Things will probably be a little strange on my blog for the next few days, as I've decided to experiment with statically generating my blog with Eleventy. It's a little complicated because I wanted to keep as many of my posts and category/tag feeds as possible.

To speed things up, I usually work with a subset of my posts. Generating a partial copy of my site results in 557 files and takes 3.73 seconds. When I generate the full copy of my site, it writes 13358 files in 96.73 seconds.

With any luck, I'll be able to get most of the things working before the next Emacs News post. Let's see!

View or add comments

Daily, weekly, and monthly journals: my Memento + Google Sheets + Tasks Free + Google Tasks + WordPress workflow

| android, blogging, writing

Journaling considerations:

  • A- nurses a lot in bed. I keep my phone handy and I write when she doesn’t want to let me go.
  • I also jot quick notes throughout the day so that I don’t have to keep them in my head. These go into the nearest synchronized device.
  • It’s hard to remember the context for those notes if too much time passes. A daily verbal recap for W- and a weekly summary for my blog seem to be just the right balance. Anything older than a week gets too fuzzy, while writing detailed notes every day takes too much time away from other things I’d like to do.
  • Monthly reviews give me a better perspective on big changes. It’s hard to keep enough in my head when I’m reading or writing on my phone, so I need help summarizing a month’s worth of highlights.

Here are the technical details:

I set up Memento Database on my phone and on a backup Android phone. I picked it because it can synchronize between phones in the background, and it can also sync with Google Sheets so that I can process things further.

My journal database has the following fields:

  • Date: defaults to current date
  • Note
  • Category: single value from a list. Most of my entries go into Gross Motor, Fine Motor, Language, Self-care, Other, or Us, and I add other categories as needed.
  • Highlight: a number indicating the level of review this should be included in: 1 – weekly, 2 – monthly, 3 – yearly. I display this field as the status, so that it shows up on the right side.

I have a shortcut on my home screen so that I can quickly add a journal entry.

I normally sort the list by date, with recent entries on top.

As part of my weekly review, I look at recent entries, fill in any categories I skipped, and choose a few to highlight. For example, last week, I wrote 17 entries and I chose 13 to include in the weekly review.

I configured Memento’s default export formatting to include only the Note field and to export that without the field label.

I filtered the database to show only the entries within a given date range where the highlight value was greater than 0.5.

I grouped it by category so that similar entries were together. This was better than fiddling with the sorting, since this takes fewer taps to set back to my default view.

After filtering and grouping the entries, I used the “Send all > Send as text” command to send it to Tasks Free, which is a task manager that synchronizes with Google Tasks. I like the way I can drag-and-drop tasks to reorder them, which makes prioritizing so much easier on my phone. I edit the text in Tasks Free, turning the keywords into paragraphs and moving things around for better flow.

After drafting the body of the post (and possibly switching between phones, if my battery ran low), I select all the text, copy it into the WordPress app, set the categories and the title, and post the entry.

The monthly review process is quite similar. I start with a filtered view that shows all entries for last month (133 entries in November), and I group it by category. I skim all the entries, not just the ones included in the weekly review, because sometimes little moments turn out to be significant or part of a bigger pattern. After setting the highlight values for the things I’d like to include in my monthly review, I switch to another filter that shows me last month’s entries with a highlight value greater than 1.5 (28 entries in November). I send it all to Tasks Free, edit the post, copy it into WordPress, and publish.

If I manage to squeeze in some computer time, I use Google Tasks to copy the text into Emacs and then use my regular Org Mode review/publish processes.

I’ve been thinking about how I can improve this workflow. Sending text to the WordPress app doesn’t seem to work (the text disappears after I save or publish), and it’s kinda nice being able to move my weekly review task around on my task list in order to accommodate other priorities. I also like the way Google Tasks keeps the data from completed tasks, which has come in handy a few times. Tasks Free editing is more responsive, too. Synchronizing with Tasks Free seems to be more robust than synchronizing with Orgzly, since I only have to watch out for editing the same task on two devices instead of watching out for the whole file.

I’d like to get back to drawing the weekly and monthly reviews, but maybe that can wait until A-‘s sleep is more settled and my discretionary time is more consolidated. The visual journals are more fun to flip through, but the bulk and chronological views I hacked into my WordPress theme are reasonable workarounds.

View or add comments

What do I want from an annual review?

Posted: - Modified: | blogging

I’ve got most of the pieces for an annual review: monthly reviews in visual and text form, my time records, and a recent flip-through of all of my sketches. I’d like to bring my ledger of income and expenses up to date, finish reading all of my blog posts, and draw a couple of yearly summaries (monthly events, differences between 2015 and 2016, analyses). I want to make the most of my computer time, so I should think about what I want from my annual review and how I can get that more efficiently.

Highlights of the year
A month-by-month list of highlights is good for reminding me of events and getting around the fogginess of memory. There’s so much to celebrate and appreciate. This also simplifies longer-term reviews, like the 10-year review I did when I turned 30.
Differences
What did I learn? What did I forget? It can be easier to see the differences when you compare across a longer time period. This can help me solidify growth, revisit things I’ve left behind, watch out for drifting, and choose what to focus on next year.
Patterns and trends
Taking a look at the data can sometimes turn up things I wouldn’t have guessed. Time, finances, and A-‘s data too – so much to explore! This might take a little longer, since it involves code.
Decision review
This is probably better broken up into separate posts, maybe even decoupled from my annual review.
What worked well? Why? How can we make things even better?
Good for continuous improvement. Might not go into as much depth as the decision reviews.

My overall goals are to:

  • remember and celebrate the journey
  • keep improving; remember what I’ve learned and revisit what I might have shelved
  • make it easier for my future self (or other people reading my archive) to get an overview of the year
  • maybe have conversations that grow out of the updates (notes on things I’ve tried, ideas for stuff that might help)

I’ll probably end up doing my annual review in chunks instead of waiting until it’s all done, since otherwise it might take me a few months.

View or add comments

Thinking about my frequency of annual reviews

Posted: - Modified: | blogging

I’ve been doing annual reviews a few times a year: my birthday in August, the new year in January, and experiment-related reflections in February. It’s a little excessive, perhaps. My weekly and monthly reviews make it easy enough to summarize events over 12 months, so it’s not that much more effort to do a new review with a slight offset.

The experiment review has different guide questions, so that’s useful. The birthday and new year reviews have a lot of overlap, though. What happened? How am I different? What did I learn? What did I forget and want to relearn? What worked well? What do I want to focus on next? What could make this even better? The two reviews cover the same ground, especially since I don’t do New Year’s Resolutions. I like the birthday review because it’s anchored on things that are meaningful to me, and paced according to my life.

The new year review would probably be better suited to reflecting on external influences, since that’s synchronized with other people’s reviews, but external events don’t seem to matter that much to me when I reflect on my year.

People often use the Christmas/New Year break to send out family updates and pictures. Both my family and W-‘s family like taking family pictures, so we’re covered there. I feel somewhat odd about the idea of announcing things on behalf of W- or A-, or getting W- to contribute. I’m more comfortable capturing the changes in my own life, noting the occasional highlight from theirs – but with my individual voice, not a collective We. I think of it more for personal note-taking and celebration (and maybe the occasional acquaintance catching up through my archives) rather than pushing updates to a list of people whom I think should hear about our year. Opt-in is more comfortable for me than opt-out. I’m probably making it more complicated than it needs to be, but I wonder if there’s a thought in here that’s worth untangling…

I wonder how I mentally chunk my memories. Do I think of them in terms of ages: my 20s, etc.? Do I think in terms of calendar years? Years come to mind more easily than ages do when I think about milestones such as coming to Canada. So maybe that’s an argument for keeping the new year review…

There’s also the benefit of being able to send people a link to a tidy summary when they wish me a happy new year, although that happens more around birthdays anyway.

Hmm. I guess I’ll try to squeeze another annual review in this month, and then I can reconsider the question in August. More writing is good, anyway.

View or add comments

Posting more thoughts

Posted: - Modified: | blogging

I can write on my phone while nursing, which is probably a far better occupation for my mind instead of scrolling through Facebook or Reddit for the nth time. It’s not my ideal writing setup – I can see around a paragraph or two on the screen at a time, and I don’t have the outlining/linking/figuring-out tools I’m used to on my computer – but it gets me writing in full sentences instead of just jotting down lists. I can capture more thoughts this way, and I don’t have to stay up late to get through my drawing backlog.

It’s important to me to be able to flesh out thoughts a little despite the interruptions of life with a baby. With a place to store these half-finished thoughts, I can make some progress. I’m not trying to write a great novel (or that Emacs book I planned a long time ago) – just exploring thoughts and questions and ideas, and storing hooks for associative memories.

A- nurses a lot, which we’re okay with. More sustenance and comfort for her, and our lives are flexible enough to accommodate it. I focus on her when she wants interaction, and I keep my phone handy for when she seems to be nursing to sleep. It’s a practice I could probably help her get out of, but things are also fine the way they are. I’ll probably let her take the lead on this one, at least for now.

What do I want to think about during these moments?

  • For the present: task lists, decisions, questions, research
  • For weekly and monthly reviews: highlights, memories
  • For future Sacha: sketches of daily life, thoughts, things I’m learning
  • For other people: things I figured out the hard way; counter-intuitive or alternative experiences; ideas and thoughts
  • For family and friends: stories

There are lots of things I can think through and write about, even in small chunks and without tools for structure. I’ll experiment with writing about and posting more of them. After all, my blog started with a few years of random snippets and thoughts. I don’t mind spending a few more years writing about mundane things and incomplete thoughts that might not be of much interest to other people, just in case it might be of interest to my future self. I’ve already set up categories and filtered mailing lists, so people can choose what to read. I can write more for myself, and enjoy what serendipitous conversations come my way. :)

View or add comments

Fixed paragraph breaks in WordPress, no more wall of text

| blogging, development, wordpress

While trying out the “after” filter I just added to my blog, I noticed that my paragraph breaks were missing. I hadn’t noticed it for a while because I’ve been building up my weekly and monthly reviews from sketches instead of blog posts. How embarrassing!

(Then A- woke up and it was time for lunch, so I was a bit frazzled. But W- stepped in and took care of her, hooray!)

I saw the paragraph breaks in WordPress’ visual editor, but not the exported HTML, which just kept whitespace in between the paragraphs instead of breaking them up with tags. It happened even when I created a new post through the web interface, so it wasn’t org2blog’s fault.

I checked if the paragraph issue happened on a new install. It didn’t.

I checked if the paragraph issue happened with all the plugins deactivated. It didn’t. Aha! (Note to self: I really should set up a dev environment again…)

I turned the plugins on one by one, and I narrowed it down to the NextGen Gallery plugin. It worked after I updated that.

Anyway, things should be readable again. Hooray!

View or add comments