Skip to content

A fully local and improved Zotero-Itegration for Logseq using BetterBibTeX JSON

Notifications You must be signed in to change notification settings

schubsijan/logseq-better-zotero-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logseq-better-zotero-plugin

A fully local and improved Zotero-Itegration for Logseq using BetterBibTeX JSON

This is a plugin for Logseq that allows you to search your literature in Zotero and creates customizable literature pages. These use the Nunjucks syntax and allow for maximum customization on your side.

No API or internet connection is required, making it truly local!

  • import your literature from Zotero as you need it
  • customize the appearance of literature pages according to your needs
  • modify data with Nunjucks

Usage

usage.mp4

Installation

  1. download this repository
  2. enable Developer mode in Logseq developerMode
  3. in the Plugins window in Logseq click on Load unpacked plugin and select the downloaded repository
  4. export your Zotero library in BetterBibTeX JSON format (with keep updated enabled); you need the Better BibTeX Extension for Zotero zoteroSetup
  5. copy the full path to this BetterBibTeX JSON file into the plugin settings
  6. use the Slash-Command /better Zotero in a block in Logseq and start searching for literature

customization

  • set up the name of the slash-command, the path to the BetterBibTeX-JSON-file, the title-template and the page-template parentblock-ID in the plugin settings pluginSettings

Examples for further Title-Template: {{date}}-{{title}}, {% if authors[0].firstName and authors[0].lastName %}{{authors[0].firstName}} {{authors[0].lastName}}{% elif authors[0].name %}{{authors[0].name}}{% endif %}-{{title}} → look at Nunjucks Docs for full explanation

Example for as simple Page-Template: (ignore the unsoported-makro-erros from Logseq, only the string of the Template-Block is important not it's rendering) pageTemplate

The default Page-Template is the following:

{% if tags.length > 0 %}zotero-tags:: {{tags | join(", ", "tag")}}{% endif %}
{% if date %}date:: {{date}}{% endif %}
{% if ISSN %}issn:: {{ISSN}}{% endif %}
{% if issue %}issue:: {{issue}}{% endif %}
{% if DOI %}doi:: {{DOI}}{% endif %}
{% if pages %}pages:: {{pages}}{% endif %}
{% if volume %}volume:: {{volume}}{% endif %}
{% if itemType %}item-type:: {{itemType}}{% endif %}
{% if accessDate %}access-date:: {{accessDate}}{% endif %}
{% if title %}original-title:: {{title}}{% endif %}
{% if language %}language:: {{language}}{% endif %}
{% if url %}url:: {{url}}{% endif %}
{% if runningTime %}running-time:: {{runningTime}}{% endif %}
{% if shortTitle %}short-title:: {{shortTitle}}{% endif %}
{% if publicationTitle %}publication-title:: {{publicationTitle}}{% endif %}
{% if series %}series:: {{series}}{% endif %}
{% if seriesNumber %}series-number:: {{seriesNumber}}{% endif %}
{% if seriesTitle %}series-title:: {{seriesTitle}}{% endif %}
{% if blogTitle %}blog-title:: {{blogTitle}}{% endif %}
{% if creators %}authors:: {% for author in creators %}{% if author.firstName and author.lastName %}{{author.firstName}} {{author.lastName}}{% elif author.name %}{{author.name}}{% endif %} ({{author.creatorType}}){% if not loop.last %}, {% endif %}{% endfor %}{% endif %}
{% if libraryCatalog %}library-catalog:: {{libraryCatalog}}{% endif %}
{% if select %}links:: [Local library]({{select}}){% endif %}

{% if abstractNote %}Abstract{% endif %}

{% if abstractNote %}{{abstractNote | safe}}{% endif %}

{% if attachments.length > 0 %}Attachments{% endif %}

{% if attachments.length > 0 %}
{% for att in attachments %}  
[{{att.title}}]({{att.uri}}) {{'{{'}}zotero-imported-file {{att.select.split('/') | last}}, "{{att.path.split('\\') | last}}"{{'}}'}}
{% endfor %}
{% endif %}

Tip: copy this default Page-Template to a jinja2-codeblock in Logseq and simply modify it there according to your wishes

Acknowledgements

inspired by: the default Zotero-integration in Logseq, logseq-logtero-plugin

used tools: svelte, @logseq/libs, fuse.js, nunjucks

About

A fully local and improved Zotero-Itegration for Logseq using BetterBibTeX JSON

Resources

Stars

Watchers

Forks