Javascript-MyLogseqBlog: A cross-platform Node app that publishes a LogSeq journal as a blog via Drummer

myLogseqBlog

A cross-platform Node app that publishes a LogSeq journal as a blog via Drummer

How to install

  1. Download the app from the repo. It's a .zip file. When you uncompress you should see a folder named myLogseqBlog-main.

  2. Open the folder in the Terminal app. On a Mac you can do this by dragging the folder onto the Terminal app icon.

  3. Type npm install at the command prompt. A bunch of messages will scroll by.

  4. Edit config.json following the instructions below.

Setting up config.json

There are a bunch of values you have to set up in config.json to configure your blog. I've provided an example config.json file with those values specified, you just have to change them.

  1. twScreenName -- your Twitter screen name.

  2. logSeqJournalFolder -- the path to your LogSeq journals folder that we will build your blog from.

  3. opmlJournalFile -- optional, a path to the OPML file that myLogseqBlog generates. You don't need this file to publish your blog.

  4. blogTitle -- the title of your blog, this is displayed at the top of every page and in your RSS feed.

  5. blogDescription -- describes your blog, could be a slogan, whatever you like, it's displayed in smaller type under the title, and in your feed.

  6. blogWhenCreated -- the date and time when your blog started. It should probably be the date and time when you installed this software.

  7. blogTimeZoneOffset -- your blog will appear to be in this timezone. It's the offset from GMT of that timezone. If you're in New York, it would be -5. In England it would be 0. In Beijing it would be +8.

  8. blogCopyright -- a copyright notice. You can leave this empty if you don't have one.

  9. blogUrlHeaderImage -- the URL of a wide rectangular image to be displayed at the top of every page. There is a default image if you don't provide one.

  10. oauth_token, oauth_token_secret -- myLogseqBlog uses these values and the next one to identify you to the Drummer system, so it knows which account to store your outline under. It is not saved in the OPML file it generates. The next section explains how to get these values.

Drummer setup

Drummer uses Twitter for identity, so you will need a Twitter account to associate with your blog.

If your Twitter username is lisasimpson, your blog will be at this URL:

http://oldschool.scripting.com/lisasimpson/

To establish this connection, go to the Drummer website and log in with your Twitter account. Twitter will warn you that Drummer can do a lot of things that it won't do unless you ask it to do them.

When Drummer opens, if this is your first time using it, a file named Notes will open automatically.

You can use this outline to get the values that are needed in config.json. If you've used Drummer before you can use any file for this purpose.

In the top headline enter: localStorage and press Cmd-/ (on Mac, Control-/ on Windows and Linux).

Double-click on the headline that appears to reveal a bunch of values. The ones you want are:

  1. twOauthToken

  2. twOauthTokenSecret

Copy these values into oauth_token and oauth_token_secret in your config.json file, as described above.

How to use

First a caveat -- I am a LogSeq newbie, so my instructions will be rudimentary and possibly incomplete. But this worked for me, and hopefully will work for you. ?

First, the journals folder you specify in config.json will be public. Be sure not to add any private information to those files -- they will become public when you publish your blog. I understand it's possible to have more than one journals folder, if so you might want to set up a new one just for your blog.

Write whatever you want into your journal and when you're ready to publish, go to the myLogseqBlog folder and run the app by typing this into your Terminal app.

node mylogseqblog.js

You should see a bunch of messages scroll by, hopefully no errors. It should take no more than a couple of seconds. When it's done, try opening your blog in a browser.

http://oldschool.scripting.com/yourtwitterscreenname/

Add something new to the journal, run the app again.

Updates

v0.4.1, 1/13/22 by DW

When myLogseqBlog uploads the file, it takes care of making it public, so the manual step specified in the docs is no longer needed.

The nodes we create are of type markdown, so that the blog processor knows to render the text through a Markdown processor.

Questions, comments?

Post an issue here.

Comments

  • Please test myLogSeqBlog
    Please test myLogSeqBlog

    Jan 13, 2022

    Follow the instructions in the readme, and report success or problems here. Thanks! :-)

    https://github.com/scripting/myLogseqBlog/blob/main/README.md

    Reply
  • blog.opml is private
    blog.opml is private

    Jan 13, 2022

    Followed the instructions in README.md and when I ran node mylogseqblog.js I got the following response (sanitizing tokens):

    config == {
        "twScreenName": "andrewshell",
        "logSeqJournalFolder": "/Users/andrew.shell/code/myLogseqBlog-main/graph/journals/",
        "opmlJournalFile": "/Users/andrew.shell/code/myLogseqBlog-main/graph/journal.opml",
        "blogTitle": "Andrew's LogSeq Blog",
        "blogDescription": "Connecting LogSeq for writing with Drummer for publishing.",
        "blogWhenCreated": "Wed, 13 Jan 2022 17:36:18 GMT",
        "blogTimeZoneOffset": -6,
        "blogCopyright": "Copyright 2022, Andrew Shell.",
        "blogUrlHeaderImage": "http://scripting.com/images/2021/07/07/hopperGasStation.png",
        "blogUseCache": false,
        "urlTwitterServer": "http://drummer.scripting.com/",
        "oauth_token": "xxx",
        "oauth_token_secret": "xxx"
    }
    addJournalFileToOutline: fname == 2022_01_13.md, mdtext.length == 201
    logseqpublish: opmltext.length == 1535
    drummerCms: err.message == Can't read the file because there was an error. Code == 500.
    
    • The local file journal.opml was generated correctly
    • The file blog.opml is present in drummer
    • Going to http://drummercms.scripting.com/build?blog=andrewshell in a browser returns the following error:
    {
        "message": "Can't build the blog for \"andrewshell\" because blog.opml doesn't exist in Drummer, or is private."
    }
    
    • Looks like blog.opml is private
    Reply
  • Markdown links and images aren't rendered
    Markdown links and images aren't rendered

    Jan 13, 2022

    I had expected that I could use Markdown links, but neither text links nor images render: http://oldschool.scripting.com/rroudt/2022/01/12/000003.html?title=writingABlogInAnOutline

    CleanShot 2022-01-14 at 00 22 30@2x
    Reply