Sommerregen / grav-plugin-external-links

This plugin adds small icons to external and mailto links, informing users the link will take them to a new site or open their email client.
Other
16 stars 14 forks source link

Suggestions re: changing behavior based on the presence of URL flag? #28

Closed paulhibbitts closed 4 years ago

paulhibbitts commented 5 years ago

Hi @Sommerregen , thanks again for this fantastic Plugin - it's been very valuable in all of my published Grav skeletons!

I was wondering if you might have insights to share re: changing behavior based on the presence of URL flag? For example, I use the flag 'chromeless' or 'embedded' to only display page content when displaying a Grav page within another system (i.e. LMS) and would like to then display external links in the parent frameset (or disable External Links) but when viewing the site directly prefer to display external links in a new Browser window. Would you see a way to do this using your existing filter/etc options or would this require some new PHP? If new PHP code is required, might I be able to do it via my theme's PHP vs. an updated version of your plugin?

I've also tried something like this in Page Frontmatter but no luck yet (results in 'array_merge(): Expected parameter 2 to be an array, string given'):

'external_links': '{{ not grav.uri.param(''chromeless'') }}'

UPDATE: I've been able to temporarily disable External Links based on this Twig variable frontmatter:

external_links:
    'process':  '{{ grav.uri.param(''chromeless'') }}'

This might just be enough to solve my issue. Ideally, I'd like to actually change the Target of External Links per-page depending on that check.

Thanks for any ideas you are able to share! Paul