# Nanopub for Hugo

**URL:** <https://discourse.gohugo.io/t/nanopub-for-hugo/14281>\
**Category:** support\
**Created:** [September 19, 2018, 1:43pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281 "2018-09-19T13:43:33Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![bradbice](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bradbice/32/14162_2.png) [@bradbice](https://discourse.gohugo.io/u/bradbice)\
**Post date:** [September 19, 2018, 1:43pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/1 "2018-09-19T13:43:33Z")

</div>

(This seems iffy as a “support” topic, so please let me know if this should be moved.)

I’d like to open up a discussion on how best to set up a Hugo site with micropub and [nanopub](https://github.com/dg01d/nanopub), or specifically, how to publish to a Hugo blog/site via third party service such as [http://micro.blog](http://micro.blog).

The documentation on the nanopub site is fairly limited, it seems. I was able to install the service on my site, though I am using Netlify for hosting which does not allow for PHP to be run (if I’m understanding correctly.)

Another possible solution would be [webpage-micropub-to-github](https://github.com/voxpelli/webpage-micropub-to-github) though this is tailored for Jekyll sites and was a little confusing for me as well.

I’d really like to use my own site to post thoughts remotely using an app such as micro.blog or others, but I do understand it’s difficult with a static site generator.

Anyone else interested in exploring this and sharing our journies?

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [September 19, 2018, 1:58pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/2 "2018-09-19T13:58:10Z")

</div>

I wonder if this is relevant? :

> [@Hugo for Microblogs](https://discourse.gohugo.io/t/hugo-for-microblogs/12069):
>
> Wanted to know what’s right way to use Hugo for microblogging. The blog posts will not have a title, only a content body, the same as posting on Twitter and Facebook. The issue with Hugo is the permanent links seems to be tied to the title or rather displayed in the title field along with the title. Removing the title from the front matter is also removing a permanent link to the actual post. This is somewhat fixed with long form content with a Read More tag, but microblogging tends to be 1 o…

---

<div class="post-metadata">

**Author:** ![bradbice](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bradbice/32/14162_2.png) [@bradbice](https://discourse.gohugo.io/u/bradbice)\
**Post date:** [September 19, 2018, 2:01pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/3 "2018-09-19T14:01:54Z")

</div>

It’s definitely partially relevant. It’s the only thing I found when searching, but only refers to the content piece, and not so much of the posting externally part, which is what I’d like to focus on in this thread.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [September 19, 2018, 3:37pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/4 "2018-09-19T15:37:37Z")

</div>

You could do something like this in your `layouts/index.html`.

It will list all posts, ordered by date descending, and will only show the post content.

```auto
{{ range where .Pages.Date.Reverse "Section" "post" }}
<p>{{ .Content }}</p>
<hr>
{{ end }}

```

Then you could create/edit posts remotely with something like [Forestry.io](http://Forestry.io)

> **[Static CMS for Hugo & Jekyll](https://forestry.io/#/)**
>
> Static CMS for Hugo & Jekyll sites, powered by Git. A better way to build sites.

---

<div class="post-metadata">

**Author:** ![bradbice](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bradbice/32/14162_2.png) [@bradbice](https://discourse.gohugo.io/u/bradbice)\
**Post date:** [September 19, 2018, 5:27pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/5 "2018-09-19T17:27:14Z")

</div>

Again, focusing on the remote posting here. Formatting of microposts is another topic 🙂

Forestry is a decent option, however it’s quite buggy in my experience. Do they have an app coming, does anyone know? The nice thing about something like micro.blog is that you’re instantly sharing to multiple sources with one easy app posting.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [September 19, 2018, 8:34pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/6 "2018-09-19T20:34:54Z")

</div>

What do you mean by _app_?

From what I’ve seen they have a web app that is also mobile-friendly.

---

<div class="post-metadata">

**Author:** ![bradbice](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bradbice/32/14162_2.png) [@bradbice](https://discourse.gohugo.io/u/bradbice)\
**Post date:** [September 19, 2018, 8:37pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/7 "2018-09-19T20:37:10Z")

</div>

Sorry, specifically I mean a mobile app for iOS/Android, that is specifically made for posting. Forestry’s web app is frustratingly buggy, and I need to write each post as a “post” – a full blog post with categories, title, etc. When all I really want to do is _tweet_ (in essence) and be done.

Does that make sense?

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [September 19, 2018, 8:44pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/8 "2018-09-19T20:44:05Z")

</div>

Gotcha. Well, I don’t have anything else to add as of now.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [September 20, 2018, 4:44pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/9 "2018-09-20T16:44:06Z")

</div>

It makes sense.

But there is no mobile app out there that would do this for your Hugo project as simple as you want.

The closest thing, I’ve seen on mobile (and it’s only for Android) is the [Termux](https://termux.com/) terminal emulator.

There is even a Termux [apt repo](https://termux.holehan.org) for Hugo courtesy of @holehan

I suppose that you could have a Hugo archetype in your project for your microposts, so that all necessary front matter is generated automatically.

Then execute the command `hugo new "/posts/some.md"` from your phone. Open that file with your favorite Android markdown editor and just write what you want.

You would also need an Android git client, so that once you save your micropost, you could then push to your repo and trigger a build.

---

<div class="post-metadata">

**Author:** ![bradbice](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bradbice/32/14162_2.png) [@bradbice](https://discourse.gohugo.io/u/bradbice)\
**Post date:** [September 20, 2018, 5:51pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/10 "2018-09-20T17:51:45Z")

</div>

There is an app, it’s called micro.blog 🙂

However, as I mentioned in my first post, it requires use of micropub standards and libraries like nanopub, as demonstrated by [https://ascraeus.org](https://ascraeus.org).

And [https://github.com/voxpelli/webpage-micropub-to-github](https://github.com/voxpelli/webpage-micropub-to-github) which works with Jekyll and connects to Github to push in the content.

The mobile app aspect is mainly to post content to your micropub endpoint easily via an established UI. micro.blog is merely an example of something that will do that.

---

<div class="post-metadata">

**Author:** ![skippy](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@skippy](https://discourse.gohugo.io/u/skippy)\
**Post date:** [September 21, 2018, 6:44pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/11 "2018-09-21T18:44:26Z")

</div>

I wrote my own micropub endpoint for use with Hugo, too: [https://github.com/skpy/micropub](https://github.com/skpy/micropub) It does use PHP. I don’t use Fastly, so I can’t provide much help there.

I use Quill to post to my site most of the time: [https://quill.p3k.io](https://quill.p3k.io). There’s also Indigenous as a dedicated mobile client, as well as a few others.

---

<div class="post-metadata">

**Author:** ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)\
**Post date:** [September 21, 2018, 10:02pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/12 "2018-09-21T22:02:05Z")

</div>

If you’re going really _micro_ (i.e., \< 300 characters), I’d put it in a Google Sheet and use IFTT or Zapier to automate all of it (e.g. using a webhook with something like Netlify) and push to Twitter, etc. You could probably do this with O365 and MS Flow too, or even start the workflow in Twitter and work backwards.

Then you have a mobile app to use, a single source for COPE (create once, publish everywhere), and the benefit of treating all your “posts” as serialized data for uber-easy export to whatever you want in the future (i.e. if you start with a spreadsheet). You also don’t have to worry about individual markdown files, which would be a royal PITA for something as simple as microblogging/Tweeting.

Win-win-win.

---

<div class="post-metadata">

**Author:** ![bradbice](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bradbice/32/14162_2.png) [@bradbice](https://discourse.gohugo.io/u/bradbice)\
**Post date:** [September 22, 2018, 12:55am UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/13 "2018-09-22T00:55:26Z")

</div>

Good ideas.

I do want to maintain this set of requirements:

- Own my content (maintain content under my domain)
- Keep markdown files for individual permalinks as needed
- Post using microformats such as micropub, if possible

I’m looking into IFTT as an easy way to grab my few lines of text and publish them to Github.

---

<div class="post-metadata">

**Author:** ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)\
**Post date:** [September 22, 2018, 1:07am UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/14 "2018-09-22T01:07:26Z")

</div>

Gotcha, but real “permalinks” require individual URLs/pages, not hashes, IMHO, if the idea is to keep them as individual markdown files rather than just a list of links on a single page. (My fault for misunderstanding this requirement from you.)

What I was thinking with Google Sheet is that you can have Sheets publish a spreadsheet to a long, publicly available CSV every time you make a change. Then have IFTT also watch for that change and post to a webhook (this is easy enough with Zapier as well), which would trigger a Hugo build that pulls from `getCSV`. This is simple to do out of the box with Netlify too, btw.

But if you want the individual markdown files, I guess my rec was a little misguided 😄

---

<div class="post-metadata">

**Author:** ![dg01d](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dg01d/32/2571_2.png) [@dg01d](https://discourse.gohugo.io/u/dg01d)\
**Post date:** [September 25, 2018, 8:26pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/15 "2018-09-25T20:26:59Z")

</div>

Hi,

Author of nanopub here.

I’m afraid I don’t have any experience of netlify at all, however, so I’m not sure what assistance I can be.

In respect of documentation, I admit that I haven’t gotten any feedback in relation to deficiencies, but would be happy to take any criticisms. The documentation as it stands is certainly written from the point of view of deploying on a VPS, rather than using a system such as netlify. I guess you could run nanopub as an endpoint on a separate server, feeding the finalised document into something like netlify, but then why use netlify at all?

The set of requirements which you state are the ones which I had in mind when I wrote nanopub, and, as you point out, I use it on my own site with Hugo.

I’m sorry if this post seems elliptical, but please do make contact if you have queries or advice in relation to the documentation, and I’d be happy to assist in any way with the program.

Oh, looping back to Hugo, I can also provide details of the methods I use in relation to post structure, hit me up for details 🙂

–  
dgold

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [September 25, 2018, 8:29pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/16 "2018-09-25T20:29:49Z")

</div>

> [@dg01d](#):
>
> I’m afraid I don’t have any experience of netlify at all

Netlify cannot run PHP on its server. It allows **only** static pages.

---

<div class="post-metadata">

**Author:** ![bradbice](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bradbice/32/14162_2.png) [@bradbice](https://discourse.gohugo.io/u/bradbice)\
**Post date:** [September 27, 2018, 1:57pm UTC](https://discourse.gohugo.io/t/nanopub-for-hugo/14281/17 "2018-09-27T13:57:34Z")

</div>

Thank you for replying here! I apologize if my initial post(s) felt critical of your nanopub documentation. I mostly meant that the docs were limited as far as my own use, and I should edit the above to reflect that. It seems my implementation at Netlify is limiting my feature set, so I will likely reevaluate that. I am using Netlify mostly because of their tight integration with Hugo and easy build hooks.

I will certainly get in touch with you if I have more specific questions. Thanks again!
