A plugin to export pages in Logseq to Hugo.

Overview

Contributors Forks Stargazers Issues MIT License


Logo

logseq Schrödinger

An awesome Logseq plugin to jumpstart your digital garden 🌱 !
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Installation
  3. Configuration
  4. Issues
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product Name Screen Shot

Logseq is a great PKM (personal knowledge management) tool, but keeping your knowledge for yourself only get s you so far. As Erwin Schrödinger stated:

If a note is not published, does it really exist? — Erwin Schrödinger

Knowledge is meant to be treasured and expanded, but before all shared. This plugin helps to make that possible, or at least easier.

Note: This project is very much a work-in-progress. Please report sssues and questions.

(back to top)

Installation

Preparation

  • Click the 3 dots in the righthand corner and go to Settings.
  • Go to Advanced and enable Plug-in system.
  • Restart the application.
  • Click 3 dots and go to Plugins (or Esc t p).

Install plugin from the Marketplace (recommended)

  • Click the Marketplace button and then click Plugins.
  • Find the plugin and click Install.

Install plugin manually

  • Download a released version assets from Github.
  • Unzip it.
  • Click Load unpacked plugin, and select destination directory to the unzipped folder.

(back to top)

Configuration

  • Click the 3 dots in the righthand corner and go to Settings.
  • Go to Plugin Settings.
  • Select correct plugin.

Configuration screen

(back to top)

Meta-data

The plugin uses YAML for the Hugo front-matter. It will convert Logseq page-properties to Hugo front matter.

Logseq keywords are lowercase converted to Hugo keywords, and category in Logseq is translated to categories for use with Hugo. Logseq links ([[like_this]]) are stripped of [[ and ]].

All other keywords are just converted to Hugo keywords.

For now you must add date with the posts date in the form of "2012-04-06" to your Logseq page-properties.

markdown date:: 2012-04-06

Configuring Hugo

Hugo does not by default support backlinks. Use a snippet like the following to simulate backlinks. It will parse every page for local links. This snippet should be placed in ~yourhugo/layouts/partials/backlinks.html.

{{ $re := $.File.BaseFileName }}
{{ $backlinks := slice }}
{{ range where .Site.RegularPages "Type" "page" }}
   {{ if and (findRE $re .RawContent) (not (eq $re .File.BaseFileName)) }}
      {{ $backlinks = $backlinks | append . }}
   {{ end }}
{{ end }}

{{ if gt (len $backlinks) 0 }}
  <aside>
    <h3>Backlinks</h3>
    <div class="backlinks">
      <ul>
       {{ range $backlinks }}
          <li class="capitalize"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
       {{ end }}
     </ul>
    </div>
  </aside>
{{ else  }}
  <aside>
    <h4>No notes link to this note</h4>
  </aside>
{{ end }}

<aside class="related">
  {{ $related := .Site.RegularPages.Related . | complement $backlinks | first 3 -}}
  {{ with $related -}}
  <h3>slightly related</h3>
  <ul>
  {{ range . -}}
  <li class="capitalize"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
  {{ end -}}
  </ul>
  {{ end -}}
</aside>

Admonitions

Logseq has several built-in adminitions, namely:

  • caution
  • example
  • important
  • note
  • pinned
  • tip
  • quote
  • warning

These get converted to:

{{< logseq/orgCAUTION >}}Caution here{{< / logseq/orgCAUTION >}}
{{< logseq/orgEXAMPLE >}}This is an example{{< / logseq/orgEXAMPLE >}}
{{< logseq/orgIMPORTANT >}}This is important{{< / logseq/orgIMPORTANT >}}
{{< logseq/orgNOTE >}}This is a note{{< / logseq/orgNOTE >}}
{{< logseq/orgPINNED >}}This is pinned{{< / logseq/orgPINNED >}}
{{< logseq/orgTIP >}}This is a tip{{< / logseq/orgTIP >}}
{{< logseq/orgQUOTE >}}This is a quote{{< / logseq/orgQUOTE >}}
{{< logseq/orgWARNING >}}This is a warning{{< / logseq/orgWARNING >}}

So Hugo needs in $HUGO/layouts/shortcodes/logseq/:

orgCAUTION.html   
orgEXAMPLE.html   
orgIMPORTANT.html 
orgNOTE.html      
orgPINNED.html    
orgQUOTE.html     
orgTIP.html       
orgWARNING.html

And they should contain something along the lines of:

<div class="caution {{ .Get 0 }}">
    {{ .Inner | $.Page.RenderString }}
</div>

(back to top)

Issues

See the open issues for a full list of proposed features (and known issues).

What works

  • Local Hugo links (but Logseq uses one folder for everything, so Hugo does too)
  • Block refs(!) — On conversion the block is pulled from the other location
  • Images
  • Basic Markdown styling (including highlighting!)

What is known to not work

  • Indentation Logseq Hugo is still a work-in-progress

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Aryan Sawhney - @Aryan Sawhney

Project Link: https://github.com/sawhney17/logseq-schrodinger

(back to top)

Acknowledgments

I would like to thank Alex Qwxlea (@twitter_handle) for the idea to write this Logseq plugin. Also for breaking the plugin after I wrote it. And finally, thank him for adding this note: Qwxlea, you're the best 😁 !

Comments
  • Remote image display issue & Filtering extra image formatting text

    Remote image display issue & Filtering extra image formatting text

    In Logseq: image

    Exported md:

    Illustration of Logseq's implemented task states:
    
    - [Discoed Link](https://discord.com/channels/725182569297215569/725182570131751005/952564162792402976)
    
    ![logseq_implemented_task_states](https://raw.githubusercontent.com/charleschiu2012/image-hosting/main/img/logseq_implemented_task_states.png){:height 290, :width 1216}
    
    ---
    

    In Hugo: image

    opened by CharlesChiuGit 2
  • Multiline Adminitions not converted correctly on export

    Multiline Adminitions not converted correctly on export

    Problem: The regex pattern in the export script is only looking for adminitions terminated by a newline character. This does not work if the adminition extends over several lines.

    Solution: Included newlines in the regex, excluded newlines from the pattern where they're not needed and terminated the search pattern by the string #+END_. Hope this works for all cases.

    opened by dom8509 1
  • REF_NOT_FOUND when using page links with namespaces

    REF_NOT_FOUND when using page links with namespaces

    Problem: Data in Logseq: test 1/page 1 -> has link to page 2 [[test 2/page 2]] test 2/page 2 -> has link to page 1 [[test 1/page 1]]

    Export with the plugin to Markdown: content/pages/test 1/page 1.md -> link to {{< ref "test 2/page 2" >}} -> not working! content/pages/test 2/page 2.md -> link to {{< ref "test 1/page 1" >}} -> not working!

    Solution: Add /page/ before each page link; {{< ref "/page/test 2/page 2" >}

    opened by dom8509 1
  • Where is the demo?

    Where is the demo?

    Hi, I would really love to see a demo of this project, however, If you click the "view demo" link, it doesn't really take you to a demo site, it only loops you back to the same github repo page.

    opened by jarodise 1
  • Option to customize export folder

    Option to customize export folder

    Currently all exported markdown is placed into the “pages” folder. Although it works fine this way, it would be nice to have a setting to allow us to choose the destination folder. For example, I’d like to place the exported markdown in a folder called “notes”.

    opened by dldsantos 0
  • Generate page hierarchies

    Generate page hierarchies

    As noted in #29, I make use of Logseq's built-in hierarchy functionality, where creating a page like [[Mr Color/GX/3 Red]] creates a new page nested underneath parent pages. In this case, [[Mr Color]], [[Mr Color/GX]], and finally [[Mr Color/GX/3 Red]]. If the parent pages do not exist,they are added to the graph automatically, analogous to mkdir -p mr-color/gx/3-red.

    Additionally, the generated pages are aware of their hierarchies:

    • parents know about their children, and list them
    • children know their path, and list it

    Parent:

    Screen Shot 2022-11-05 at 4 40 16 PM

    (Grand) child:

    Screen Shot 2022-11-05 at 4 40 31 PM

    Schrodinger already creates these pages, but they lose awareness of their hierarchy links. It would be useful for these to be surfaceable in a published site link backlinks. Unfortunately, because they are not links present in the content, they do not get generated, and would require new work to do so.

    Could these be added to page front matter? Maybe

    # Mr Color
    hierarchy:
      - {{ ref . "pages/mr-color/gx" }}
      - {{ ref . "pages/mr-color/gx/3-red" }}
      - {{ ref . "pages/mr-color/gx/1-white" }}
      - {{ ref . "pages/mr-color/surfacer" }}
      - {{ ref . "pages/mr-color/surfacer/500" }}
    
    # Mr Color/GX
    hierarchy:
      - {{ ref . "pages/mr-color/gx/3-red" }}
      - {{ ref . "pages/mr-color/gx/1-white" }}
    
    # Mr Color/GX/1 White
    hierarchy:
      - {{ ref . "pages/mr-color/gx" }}
    
    opened by flyinggrizzly 0
  • Does not respect `:publishing/all-pages-public? true` setting

    Does not respect `:publishing/all-pages-public? true` setting

    I've been trying to get this set up, and every time I try to export the pages to Hugo nothing was happening.

    I have the :publishing/all-pages-public? true setting configured in Logseq.

    I tried setting one single page to public:: true, and then export, and finally got the destination dialog.

    In my case, all pages in Logseq should be presumed public unless explicitly specified public:: false, since I'm using it as a topic-specific blogging tool, and I'd prefer not to have to remember to set all pages to public:: true, especially since I hierarchically nest pages in some cases, using the upper nodes of the hierarchy just as aggregation points. Eg:

    • [[Mr Color/GX 3 Red]]
    • [[Mr Color/Surfacer/500]]
    • [[Mr Color/Surfacer/1000 Mahogany]]

    In these cases, [[Mr Color]] and [[Mr Color/Surfacer]] don't need full pages of their own--they're useful primarily as catalogs of their child pages. I do this a lot (also for dates), so having to go through and edit each of these upper nodes would be tedious.

    opened by flyinggrizzly 6
  • Is it possible to put the logseq-plugin to hugo site?

    Is it possible to put the logseq-plugin to hugo site?

    1. I use the table of content plugin in logseq. Let me think that is possible to put the plugin function into the hugosite.

    1. On the other hand,the hugo site has some function that is similar to logseq-plugin. Maybe we can let it replace automatically.

    For example:

    • https://adityatelange.github.io/hugo-PaperMod/posts/papermod/papermod-features/#show-table-of-contents-toc-on-blog-post
    opened by xiang0805 0
  • Twitter embeds

    Twitter embeds

    Hello!

    Would it be possible to make tweet embeds work like the YouTube video embeds?

    Also, related: For the YouTube embeds, I see in the code that it is prompted by {{youtube insertidhere}}, but the embed in Logseq defaults to {{video insertidhere}}. Would you be able to change it so either works?

    Thanks!

    opened by jlcolbert 1
Releases(1.3.0)
Owner
Maker of @logseq plugins + more cool stuff
null
Fast Hugo gallery theme/module suitable for lots of images.

Gallery Deluxe A Hugo Module to show a photo gallery. It's very fast/effective, especially if you have lots of images on display. See the annotated in

Bjørn Erik Pedersen 51 Jan 2, 2023
A logseq plugin to extract tweets. Optionally tag the tweet's author as well.

Logseq Twitter Extractor Plugin If this plugin helps you, I'd really appreciate your support. You can buy me a coffee here. A quick utility to parse a

null 17 Nov 17, 2022
Migrate unfinished tasks to today, Logseq plugin

Unfinished-business Unfinished Business Because the day may be over, but your business isn't View Demo · Report Bug · Request Feature This plugin migr

Alex 23 Nov 16, 2022
Plugin that lets you create diagrams from textual representation (aka 'Diagrams as Code') within Logseq

Logseq - Diagrams as Code Plugin that lets you create diagrams (and other visualizations) from textual representation (aka 'Diagrams as Code') within

Nicolai P. Großer 80 Dec 21, 2022
A simple to-do list plugin for logseq

Logseq Todo Plugin A simple to-do list plugin for logseq Feature quick add new to-do items to today's journal page show all today's to-do items (inclu

Yuexun Jiang 71 Jan 1, 2023
A file manager plugin for logseq(Search unused assets file)

logseq-plugin-file-manager Search files from assets and draws but not used in journals or pages. Please backup files before operation, and before dele

Hayden Chen 17 Dec 23, 2022
a Logseq plugin to float items (e.g. videos) for an improved note-taking experience

logseq-helium-plugin Features Float videos for better note-taking in 3 ways: Block context menu (right-click on bullet) → ?? Start float Slash (/) com

Vivian Leung 58 Jan 2, 2023
Flexible plugin for Logseq that annotates deadline/schedule times with a countdown or time difference

Interval Hints Synopsis Configurable Logseq plugin to annotate deadline and scheduled times with a countdown or interval. Features Block renderer to a

Kerfuffle 8 Aug 29, 2022
A plugin for GPT-3 AI assisted note taking in Logseq

logseq-plugin-gpt3-openai A plugin for GPT-3 AI assisted note taking in Logseq Usage Just type /gpt3 in a block or select gpt3 from the block menu. Se

Brian Sunter 301 Jan 3, 2023
This Plugin is For Logseq. If you're using wide monitors, you can place journals, linked references, and journal queries side by side.

Logseq Column-Layout Plugin Journals, linked references, and journal queries can be placed side by side if the minimum screen width is "1850px" or mor

YU 14 Dec 14, 2022
Icons for links. Logseq Plugin

"Awesome Links" plugin for Logseq Favicons for external links! ?? Pages icons for internal links ?? Page iconsicon::extended from Emoji to hundreds ic

Yuriy Piskun 37 Dec 21, 2022
Obsidian plugin to export Graphviz graphs from vault's notes

What it is: an Obsidian plugin to generate hierarchical graphs, with the nodes are from your Obsidian vault How it does: convert the database from Bre

Ooker 22 Nov 14, 2022
An Obsidian Plugin that allows to export tables from a pane in reading mode to CSV files.

Obsidian Plugin "Table to CSV Exporter" This is my very first attempt in writing a plugin for Obsidian. I didn't even know TypeScript before (but Java

Stefan Wolfrum 26 Dec 27, 2022
A Tempermonky / Greasemonkey plugin which can help you export your class schedule to the calendar on your phone / pad / PC / Mac.

WHU Class Schedule Export as iCS Languages: English | 簡體中文 | 繁體中文 Changelog v0.90.1 - Sep 18, 2022 Fix bugs: Fix an error when a class have multiple s

Ostrich_B 6 Sep 7, 2022
An obsidian plugin for uploading local images embedded in markdown to remote store and export markdown for publishing to static site.

Obsidian Publish This plugin cloud upload all local images embedded in markdown to specified remote image store (support imgur only, currently) and ex

Addo.Zhang 7 Dec 13, 2022
tools and plugins for logseq

logtools tools and plugins for logseq logtools-css-productivitypack my css mods for Kanban/columns view (#.v-kanban), Einsihower Matrix (#.v-einsenhow

null 126 Jan 2, 2023
Weekly, Monthly and Yearly notes in Logseq!

Periodic Notes for Logseq Currently is very early stages. My roadmap for releasing on the Logseq marketplace can view viewed here Functionality Curren

Brendon 12 Dec 29, 2022
logseq custom.js and custom.css utilities : resize query table columns, hide namespaces...

logseq-custom-files custom.js and custom.css utilities for Logseq. current version v20220331 query table view : add handles on the query table headers

null 44 Dec 7, 2022
Embed Luckysheet (spreadsheet) into Logseq.

logseq-plugin-luckysheet 在 Logseq 中嵌入电子表格 Luckysheet。你也可以用它来维护一张 markdown 表格。 Embed Luckysheet (spreadsheet) into Logseq. You can also use it to maint

Seth Yuan 49 Jan 1, 2023