middleman-ogp icon indicating copy to clipboard operation
middleman-ogp copied to clipboard

Support asset hash

Open ngs opened this issue 5 years ago • 6 comments

Fixes #6

ngs avatar Jun 02 '20 15:06 ngs

This looks great! I've just checked this against our website and it works as expected.

tisba avatar Jun 03 '20 09:06 tisba

I just realised, that this does not seem to work with assets outside of the image path. That might be our fault, but the asset digest logic works fine... Need to take another look.

tisba avatar Jun 03 '20 13:06 tisba

I'm trying to wrap my head around another change: I also noticed that you've dropped base_url. Is there a way to ensure that attributes like og:url and og:image are full, absolute URLs now?

Reading https://ogp.me it looks like og:url needs to be URL and cannot be a path 🤔

tisba avatar Jun 03 '20 19:06 tisba

Currently I'm mis-using http_prefix so will recover base_url.

ngs avatar Jun 03 '20 20:06 ngs

For images actually, one can set activate :asset_host, host: "https://example.com" and this branch will do the right thing for the image. But that does not seem to work for og:url.

tisba avatar Jun 03 '20 20:06 tisba

I'm not that familiar with middleman internals, but it looks like Middleman::Util.url_for(app, obj) takes an option called relative. Maybe this can be used somehow?

tisba avatar Jun 04 '20 06:06 tisba