bmann / microglue

A small glue API server to create a micropub endpoint that can publish to Jekyll and other static sites via git
MIT License
6 stars 0 forks source link

Own Your Gram #9

Open bmann opened 6 years ago

bmann commented 6 years ago

https://ownyourgram.com -- does a really good job of walking you through getting setup.

Once done -- it will upload ALL of your instagram images.

Here's what the default post looks like:

---
layout: single
date: '2018-05-22T22:03:38.000Z'
title: ''
mf-location:
  - 'geo:49.283273,-123.1094283'
mf-syndication:
  - 'https://www.instagram.com/p/BjGIXviFNEM/'
mf-place_name:
  - Revolver
slug: '79418'
mf-photo:
  - 'https://blog.bmannconsulting.com/images/2018-05-22/ig-p5s0qs.jpg'
category: social
---
First espresso tonic of the season @revolvercoffee. So excite!
bmann commented 6 years ago

Looks like OWG does support multiple images (that mf-photo is an array), but apparently not all the images make it up to github. So....for best results, only one IG image per post.

cc @patdryburgh if you want to note anything here.

bmann commented 6 years ago

Also, here's what I did with the location and place name to get a link to open street maps:

{% if page.mf-place_name[0] %}
{% assign place = page.mf-place_name[0] | url_encode %}
{% assign geo = page.mf-location[0] | remove: "geo:" %}
<h3><a href="https://www.openstreetmap.org/search?query={{ place }}&{{ geo }}#map=18">{{ page.mf-place_name[0] }}</a></h3>
{% endif %}
bmann commented 6 years ago

@patdryburgh you're also going to need to modify your micro feed, something like this:

{% if post.mf-photo[0] %}
          {% assign place = "" %}
          {% if post.mf-place_name[0] %}{% assign place = post.mf-place_name[0]%}{% else %}{% assign place = post.mf-location[0] | remove: "geo:" %}{% endif %}
          {% capture image %}<img src='{{ post.mf-photo[0] }}'>{% endcapture %}
          {% capture content_text %}{{ post.content | strip_html | strip }}{% if place != "" %} @ {{ place }}{% endif %}{% endcapture %}
          {% capture content_html %}{{ image }}<p>{{ post.content | markdownify | strip | remove: "<p>" | remove: "</p>" }}{% if place != "" %} @ {{ place }}{% endif %}</p>{% endcapture %}
        {% else %}
          {% capture content_text %}{{ post.content | strip_html }}{% endcapture %}
          {% capture content_html %}{{ post.content | markdownify }}{% endcapture %}
        {% endif %}

Basically, if this is an Instagram post, you're going to want to "glue" the image to the content, since you can't modify the content. Plus I did some stuff with place name in IG.

bmann commented 6 years ago

Page 7 onwards has a bunch of examples -- https://blog.bmannconsulting.com/page7/