Skip to content
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

Ability to parse more than markdown file for links? #14

Closed
miklb opened this issue May 26, 2016 · 7 comments
Closed

Ability to parse more than markdown file for links? #14

miklb opened this issue May 26, 2016 · 7 comments

Comments

@miklb
Copy link

miklb commented May 26, 2016

Might be a vague title, not sure how to phrase. Basically I'd like to add a conditional to my _includes/post.html file to check if some Front Matter exists, and if so, add a link to brid.gy.

If you can give an idea of how, I'd be happy to attempt to provide a pull request, just not that familiar with Ruby/Jekyll internals.

Longer explanation, I'm working through a micropub endpoint and want to test type of post to determine whether to POSSE based on Front Matter, specifically a syndicate-to link provided via micropub.

@aarongustafson
Copy link
Owner

So, just to be clear, you want to be able to ping other URLs stored in the front-matter (in addition to those contained in the content of the post). Is that right? If so, it should not be too difficult.

@miklb
Copy link
Author

miklb commented May 26, 2016

@aarongustafson that would be an interesting approach, but what I'd like to do is

{% if post.mf-syndicate-to != null %}
    <a href="https://brid.gy/publish/twitter"></a>
    {% endif %}

As I mentioned, I'm using a micropub client that I can define a syndicate-to link, which then produces

mf-syndicate-to:
  - 'http:/twitter.com/miklb'

Could be Facebook or some other silo I could POSSE to. Eventually the logic in that Liquid markup could be a check to determine what the syndicate-to links is and send the appropriate webmention via brid.gy

All of that said, if using Front Matter is easier, I could use the brid.gy endpoints, i.e. brid.gy/publish/twitter at least in the short term. I could see how Front Matter links could be useful for others when it comes to webmentions in general too.

Thanks again for your time to respond!

@miklb
Copy link
Author

miklb commented Jun 4, 2016

I'm sure you're busy, but any chance you could give me some pointers on how to parse links in Front Matter to be included in the in webmentions sent cache file?

@miklb
Copy link
Author

miklb commented Jun 9, 2016

I've gotten as far as

if post.data['mf-syndicate-to']
            targets.push ('https://brid.gy/publish/twitter')
          end

Where mf-syndicate-to is Front Matter set by my micropub client. What I haven't figured out is how to check the value of it, or ideally I think now would be to check if set, then iterate over any values and send webmentions

Hoping when you have a few free minutes can give some pointers. Thanks in advance @aarongustafson

@miklb
Copy link
Author

miklb commented Jun 19, 2016

Was making it harder on myself than I needed to.

if post.data['mf-syndicate-to']
            targets.push (post.data['mf-syndicate-to'])
          end

Was all I needed to parse the links in the front matter & send them with the plugin. I also had to do a little liquid conditional to embed the link in my template for Bridgy to pick it up.

Sorry for all of the noise on the thread, but considering this resolved. Not sure if you would entertain a pull request adding the functionality as I don't know how standard mf-syndicate-to would be.

@miklb
Copy link
Author

miklb commented Jun 28, 2016

Ran into a problem.

My Front Matter is formatted as such

mf-syndicate-to:
  - 'https://brid.gy/publish/twitter'

which is causing the plugin to parse the - or add one. In my webmentions.yml file it gets added as
- - https://brid.gy/publish/twitter which then isn't sent as a webmention.

Any suggestions?

@miklb
Copy link
Author

miklb commented Jun 28, 2016

OK, finally figured it all out

if post.data['mf-syndicate-to']
            all_links = post.data['mf-syndicate-to']
            all_links.each do |link|
                targets.push ("#{link}")
            end
          end

will loop through links in the front matter and properly insert them in the cache file.

Leaving this here if anyone comes along and wants to modify the plugin similarly.

@miklb miklb closed this as completed Jun 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants