-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blogging in Gatsby with Drummer #3
Comments
Congrats and good work! 😀 A suggestion, link to Gatsby and Drummer the first time their names appear in the post. I’m not sure about Gatsby, would want to know more, and I imagine most Gatsby users don’t know about Drummer and what it means for it to work with Gatsby. |
I've added the links, thanks for the suggestion. In a future post I can explain a little bit about Gatsby and why I use it. Right now I'm still at the point where I'm astounded that my code seems to work as I intended! 😃 |
@papascott -- I published a writeup on Scripting News. I'm banging the drum for connecting stuff together. And this is an important milestone. Maybe a video? Is there a quick tutorial for Gatsby that assumes I understand HTML, have Node installed, have run CMSes. I looked at their tutorial and simply can't find out what it;'s like to use Gatsby so I can't see how Drummer connects. |
@scripting Yeah, the present Gatsby site is quite startup-intense. A better technical explanation might be their GitHub Readme or this 13 minute video talk on What Is Gatsby. I also found a 45 minute video tutorial on Learn Gatsby: How to Build Your First Gatsby Blog where they start with a "blog starter" to create an ugly but functional blog. My executive summary:
Andrew Shell wrote a source plugin for Little Outliner OPML files. I was able to use that with minor modifications to import Drummer OPML data into my blog. I appreciated your remark about plumbers and poets in the same space. I'm certainly a plumber! 😄 |
@papascott -- glad you saw plumbers and poets. it just came to me that's what we are. i am a plumber for sure. i even have a friend who said i was the best plumber ever. i really appreciated that. ;-) you know the video i want to see -- you, using drummer to publish to gatsby. do a seat of the pants demo in youtube, that would give me most of the info i need. that's the level at which gatsby is relevant to me. |
I’ll be happy to make that video, either tomorrow or Wednesday! 😀
… On 1. Nov 2021, at 20:10, Dave Winer ***@***.***> wrote:
@papascott -- glad you saw plumbers and poets. it just came to me that's what we are. i am a plumber for sure. i even have a friend who said i was the best plumber ever. i really appreciated that. ;-)
you know the video i want to see -- you, using drummer to publish to gatsby. do a seat of the pants demo in youtube, that would give me most of the info i need. that's the level at which gatsby is relevant to me.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I've recorded a screencast of making a post: https://youtu.be/9Y4cn-GPamY |
@papascott it leaks your netlify webhook URL. Hopefully the URL is inactive now. |
@thejeshgn No worries, there's a new URL now 😄 |
@papascott this is a great video demo! I’ve been using Gatsby for my personal blog for about 18 months now and you nailed the experience. @scripting I’d say the “integration pipes” between Drummer and Gatsby are already there via GitHub and Netlify. Netlify builds and publishes static site files by reading them in .md format from GitHub. So if a tool can be used to save blog posts during creation to GitHub as .md, (which is what @papascott’s webhook does, as soon as Netlify sees a change to the GitHub repo, it regenerates and publishes the blog post pages. High level, but just some additional context on the process of Gatsby/Netlify. My first explanation of Gatsby when I decided to use it is here. So as long as something can modify Drummer blog posts to a GitHub repo in .md that Netlify is configured to watch, Netlify will use Gatsby to publish those posts by default. |
@papascott — okay now I understand what the pieces are, and I think I understand what your drummer script is doing, but the text is too small to read. Are you sending the whole opml file over to Gatsby? Is your plug-in running on Gatsby, parsing the opml and converting it to a format Gatsby understands (presumably markdown?) @kevinctofel - great to see you here! Drummer is not writing anything to GitHub, so whatever Scott is doing, he’s not depending on that. anyway you both have given me lots to think about! 😀 |
@scripting Here's my Drummer script. It in fact sends an empty object to Netlify. All hitting the URL does is trigger the build.
The plugin itself fetches the outline from the public URL when the site is built. Here are the options I'm giving the plugin:
That's correct! @kevinctofel Saving the outline to GitHub from Drummer would be a logical next step, then all my content would be in the repository. |
@papascott I suspect @scripting already has some of the plumbing done for that since he archives his blog posts to GitHub today IIRC. 😉 |
@kevinctofel -- i have lots of stuff that writes to github locations, i think it's an incredible resource and i want to use it more. but it's always been tricky from an authorization standpoint, it's easy for me to write code that posts stuff on my behalf, but for scripts, like the one @papascott is working on, i want them to use their own github resources. an example appSee this folder on GH... https://github.com/scripting/instantOutlines/tree/main/outlines/twitter Those are a bunch of twitter accounts that an app of mine checks every minute, and posts whatever they post to a large opml file and upload it to that location. spamming is a problem alreadyI could do that for every drummer user's blog.opml file, technically -- but there's another kind of security involved, not opening up all drummer users to spamming. it's amazing how quickly spammers show up these days. we had a long grace period in the early blogosphere, but this isn't like that anymore. in the meantime if there are any apps people want to try out that require publicly accessible opml files that update regularly, this is a place to start. There's actually a lot of infrastructure built up around this idea. |
Right, you don’t want to be the GitHub gatekeeper and people should be able to connect Drummer to their own GitHub repos, if I’m understanding correctly. I believe that when I hooked up Netlify and GitHub together, they used this OAuth implementation which was a once and done from a user perspective. https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#web-application-flow If it were implemented in Drummer (in theory) people would connect their GitHub repo to Drummer from Drummer, at least as far as I can tell although as a coding n00b, I could very well be wrong. Drummer would then have an access token to write to the specific user’s GitHub repo on behalf of the user. And the user could revoke that access at any time, if desired, directly through GitHub. See image for the apps/services, I’ve authorized, for example. Once connected, (again in theory) Drummer could save new blog posts to that GitHub repo, which Netlify would pick up as pull requests and kick off a build/publish process automatically. Note that I’m not asking you to do this: I’m just providing some information and thinking out loud. ;) |
@kevinctofel -- yes i think that's right. kind of like what we do with twitter, only with github. and i know from experience that's going to take a week from beginning to end. it has that feel. in the meantime @papascott made it work without all that!!! 😀 |
@kevinctofel If all you need to do is commit a single outline to GitHub on demand, we don't need any GitHub integration in Drummer. It could be done with a GitHub Action, and then a Drummer script that triggers the action over the GitHub API. I've never used GitHub Actions before, but the following on a test repository seemed to work.
|
Great thought and implementation @papascott! One question: Is the script specific to one particular GitHub repo? I don’t see any configuration on which repo so I’m assuming yes. I haven’t used GitHub Actions prior either, so I’m guessing the action is setup within a specific repo, which in this case, is the one you want to copy your OPML file to. If so, that handles the “user specific” GitHub repo questions yesterday. :) |
@papascott -- I really want to understand how this works, but I don't. esp if it's a way to get an opml file from Drummer-land into Github-land. Is that what it's doing?? |
I literally just learned this today, so I guess that makes me an expert! 😛 And yes, it does get an OPML file from Drummer-land to Github-land. As I understand them, Github Actions are like scripts that are attached to a repository. They can be triggered, for example, by things that happen to the repository (like pushes or pull requests) or by external events (like an API call or hitting a button in the GitHub website). The action I wrote starts up a virtual machine, checks out the repository, then runs some shell commands to fetch a public OPML file, save it in the repository, commit it to git, and push the commit to GitHub. I would implement this for myself by writing a script that hits the GitHub API to trigger the action. But it's my first day doing this, I haven't gotten that far yet! |
@papascott -- this is amazing. my head is exploding. the part that really got me is "starts up a virtual machine" -- what can that virtual machine do? can it by any chance run a small Node app? if so, we are going to rock this so hard. |
@scripting Yes, even their "hello world" example installs node then installs an npm package. I've seen other examples that install node, run npm install, then runs a script from the package.json. |
This whole thread is awesome 🕶 Semi-related I found myself reading English's how to and when I read this I replaced LO with Drummer in my head :) I've used github actions from other people's repos to build websites from content (you can make a template repo that others can use e.g) but never written any myself from scratch. Just thinking out loud, but one could use drummer to write outlines, commit to github, a github action runs drummercms to generate the website, and commit it to a /public folder, which then uses Github pages to host with easy domain and https setup. The template index.html, code.js and style.css can all be kept in the github repo as well. If someone wanted to integrate another outlining tool, e.g. a mobile app like Zavala, then they just need to work out of the github repo (maybe with working copy) and it's all together. That's a lot of steps there and likely reworking of things but as a possible end state, it's an example. I want to play about with it all, just whenever I get round to making the time for it. Luckily drummer is pretty cool right now 😁 |
@papascott can you explain a bit more about how you set up the workflow_dispatch part? Are you getting a personal token from GitHub and incorporating that in the call to the GitHubAction? I am also very excited about what GitHub Actions can do. Being able to schedule them as well as trigger them with API calls is great - my action doesn't yet use a workflow_dispatch, instead just running every 15 minutes (or on a manual push), downloading the files and only committing to the repo if the content has changed as opposed to looking at the timestamp.
|
@SparkyT Yeah, something like that. You can only set a token for a user that is not restricted to a single repository, so I created a machine user that collaborates on the repository. I use a token for the machine user to start the action. I've been using the new http.client verb in Drummer, something like this:
Storing the token in Web Drummer is probably not yet secure, but should be OK in Electric Drummer. |
I'm now able to use Drummer to post to my blog in Gatsby! I described it in a post that of course is written in Drummer.
My code is at https://github.com/papascott/papascott-gatsby
I started with the gatsby-demo-opmlnotes by Andrew Shell
The text was updated successfully, but these errors were encountered: