Tool to export raw Logseq Markdown pages (with public:: page property) into Markdown blog posts with front matter.
- Takes Logseq page properties (
title:: Hello world) and turns them into Front Matter propertiestitle: Hello World. - Changes the Markdown syntax to remove the top-level bullet points.
- if you have top-level block
- privatein your file,logseq-exportwill remove it and all content that follows. I use it for copyrighted content like verbatim highlights/pictures from books.
See an example of a deployed graph on viktomas.github.io/logseq-export. The graph and the Hugo project can be found in the example folder. Run the example locally with ``
Note: I completely reworked logseq-export to be a bit more versatile and universal. See the version v0.0.3 if you are not ready to move on.
- Download the latest binary for your OS in the Releases page
go install github.com/viktomas/logseq-export@latestif you have Go installed
The logseq-export utility will export the pages into an export folder that can then be imported into your static site generator.
graph LR;
LS[Logseq graph] --"logseq-export"--> EF[export folder]
EF --"import_to_hugo.sh"--> HU[Hugo static site generator]
logseq-export
-outputFolder string
[MANDATORY] Folder where all public pages are exported.
-logseqFolder string
[MANDATORY] Path to the root of your logseq graph containing /pages and /journals directories.
Optional configuration is in a file called export.yaml in your logseq folder.
# list of logseq page properties that won't be quoted in the markdown front matter
unquotedProperties:
- dateThis is how I run the command on my machine:
logseq-export \
--logseqFolder /Users/tomas/workspace/private/notes \
--outputFolder /tmp/logseq-export \This will take my logseq notes and copies them to the export folder, it will also copy all the images to /tmp/logseq-export/logseq-assets, but the image links themselves are going to have /logseq-asstes/ prefix ().
logseq-exportassumes that all the pages you want to export are inpages/folder inside yourlogseqFolder.
# these environment variables are optional
# the values in this example are default values
export BLOG_CONTENT_FODLER="/graph"
export BLOG_IMAGES_FOLDER="/assets/graph"
# copies pages from `/tmp/logseq/export/logseq-pages` to `~/workspace/private/blog/content/graph`
# copies assets from `/tmp/logseq/export/logseq-assets` to `~/workspace/private/blog/static/assets/graph`
# replaces all `/logseq-assets` in all image URLs with `/assets/graph`
./import_to_hugo.sh \
/tmp/logseq-export
~/workspace/private/blogpublic- as soon as this page property is present (regardless of value), the page gets exportedtitle- either thetitle::is present and used astitle:front matter attribute, or the page file name is unescaped (e.g.%3Achanges to:) and used as thetitle:tags- Logseq uses comma separated values (tags:: tag1, tag2) but validyamlin the front matter has to surround the value with square brackets (tags: [tag1, tag2]). Thetagsattribute is always unquoted.slugused as a file namedateit's used as a file name prefix- if your logseq
date::attributes contains the link brackets e.g.[[2023-07-30]],logseq-exportwill remove them
- if your logseq
content/graph/2022-09-25-test-page.md :
---
date: "2022-09-25"
public: true
slug: "test-page"
title: "Test page"
---
This is an example paragraph
- Second level means bullet points
- `logseq-export` also supports multi-level bullet points
```ts
const v = "Hello world"
```
You can
also
have
Multi-line strings- Have golang installed
- Use unix or WSL2 on Windows
make build- builds the binarymake test- tests the projectmake watch-test- (only on macOS) - run test on every file changemake example- export the example Logseq graph into the example Hugo sitemake watch-example(only on macOS) - runmake exampleon any file change
- tag commit on
mainbranch - first push
main, wait for pipeline to finish, then push the tag. Otherwise you confuse goreleaser.
