Giter Club home page Giter Club logo

silverbullet-ghost's Introduction

Ghost plug for Silver Bullet

This allows you to publish your pages as Ghost pages or posts. I use it to publish Zef+.

Configuration

In your SETTINGS specify the following settings:

```yaml
ghost:
  myblog:
    url: https://your-ghost-blog.ghost.io
```

Then, create a Custom Integration (in your Ghost control panel under Settings > Advanced > Integrations > Add Custom Integration). Enter a name (whatever you want), then copy the full Admin API Key in your SECRETS file, mirroring the structure of SETTINGS:

```yaml
ghost:
  myblog: your:adminkey
```

Usage

The plugin hooks into Silver Bullet's Share infrastructure. Therefore to share a page as either a Ghost page or post, add a $share front matter key. For posts this should take the shape of:

---
$share:
- ghost:myblog:post:my-post-slug
---

And for pages:

---
$share:
- ghost:myblog:page:my-page-slug
---

Now, when you {[Share: Publish]} (Cmd-s/Ctrl-s) your post will automatically be created (as a draft) or updated if it already exists.

Enjoy!

Installation

Open your PLUGS note in SilverBullet and add this plug to the list, or simply use the Plugs: Add command:

- github:silverbulletmd/silverbullet-ghost/ghost.plug.js

Then run the Plugs: Update command and off you go!

silverbullet-ghost's People

Contributors

v411e avatar zefhemel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

silverbullet-ghost's Issues

Support rendering templates

I tried adding this template:

**Last Updated**: _{{@page.lastModified}}_

And it ended up rendering as a regular code block:
image

It'd make sense imo to render template/query blocks before publishing.

`$` character in text body throws exception

Steps to reproduce

When sharing a ghost post that has a $ character in the text body, the following exception is thrown:

Post should stat with a # header
Stack trace: Error: Post should stat with a # header
    at we (eval at <anonymous> (blob:null/7ef28546-dfb0-49f2-84e1-3dab5dd37df2:1:1706), <anonymous>:3:8760)
    at B (eval at <anonymous> (blob:null/7ef28546-dfb0-49f2-84e1-3dab5dd37df2:1:1706), <anonymous>:3:9127)
    at async blob:null/7ef28546-dfb0-49f2-84e1-3dab5dd37df2:1:2013
Stack trace: Error: Post should stat with a # header
Stack trace: Error: Post should stat with a # header
    at we (eval at <anonymous> (blob:null/7ef28546-dfb0-49f2-84e1-3dab5dd37df2:1:1706), <anonymous>:3:8760)
    at B (eval at <anonymous> (blob:null/7ef28546-dfb0-49f2-84e1-3dab5dd37df2:1:1706), <anonymous>:3:9127)
    at async blob:null/7ef28546-dfb0-49f2-84e1-3dab5dd37df2:1:2013
    at blob:null/ec2700b3-4337-40f4-a9ef-9cff284a6f37:1:2338
    at l (blob:null/ec2700b3-4337-40f4-a9ef-9cff284a6f37:1:38)
    at blob:null/ec2700b3-4337-40f4-a9ef-9cff284a6f37:1:1648
    at innerInvokeEventListeners (deno:ext/web/02_event.js:755:9)
    at invokeEventListeners (deno:ext/web/02_event.js:795:7)
    at dispatch (deno:ext/web/02_event.js:664:11)
    at dispatchEvent (deno:ext/web/02_event.js:1043:14)
    at pollForMessages (deno:runtime/js/99_main.js:159:9)

Outcome

What did you expect?

I expected the post to be shared with ghost.

What happened instead?

The error was thrown and the post was not shared with ghost.

Can't publish: (intermediate value)[t] is undefined

Hey

I tried to publish a post and a page to a new personal blog (just set up from scratch) and I get the following error:

TypeError: (intermediate value)[t] is undefined
    publish https://silver.yosemitesam.ch/_plug/ghost.plug.js:1

I tried to create a new post and update the about page, both didn't really work :(
Here is the console output when I try to update the page:

image

I honestly don't really know how to debug this.

I kinda assume it's a problem with my SECRETS file, but I'm not sure. The content of it is (obviously without the backslash at the end):

My secrets!

```yaml
ghost:
  myblog: 'redacted'
\```

I just added the My secrets! to see if it changes something - it doesn't

Support tags

I just started testing this plug out, but it's pretty neat so far!

I'd like to be able to change tags on a post when sharing to ghost. Probably just reading them from the frontmatter. I'm not sure if in-line tags would make sense or not.

Support images and attachments

Here's how I would envision this to work (also given how the Ghost API works I think): in your page, you can just link or embed images as any SilverBullet page, then there's a command Ghost: Share Attachments or similar, which would upload all linked attachments in the page, and replace them with URLs to the uploaded files.

This is a mechanism that can potentially be useful not just for Ghost, but for other Share plugs as well.

Replace page links with URL links

When a page is shared to ghost (that is: there's a $share key there), it would be nice of links would be replaced with proper blog or page links when shared.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.