Closed ktaranov closed 7 years ago
Hello @ktaranov,
I haven't updated this plugin for awhile. Thus it is possible, that recent Grav updates broke the plugin. Can you tell me which Grav version you are using? And can you double check, that built_in_css: true
and mode: "active"
?
Further can you inspect your site with cache enabled? Can you try to find out, whether external_links.css
is loaded and the links in your content have the format
<a href="http://domain.com" class="external-link" rel="nofollow">Link</a>
?
Hello @Sommerregen , thanks for reply.
built_in_css: true
and mode: "active"
Problem exists for all pages in my site, for example here: http://sqlserver-kit.org/en/home/version
If you need access to admin pages email me on kast218 dot gmail.com and i send you login and password.
Dear @ktaranov ,
I don't know whether you have cache enabled or not, but actually the plugin seems to be working. I attached a screenshot. For external links (those starting with http://
or https://
) I get
and for local links the correct behavior, too.
If you like to have an icon on local links, then the best is to modifiy the stylesheet of the External Links plugin. Copy and paste it into your theme, modify it there and switch off the built_in_css: false
option. You can also set a class external
to those items if you wish. More here https://github.com/Sommerregen/grav-plugin-external-links#example .
Hello @Sommerregen , thanks for quick reply.
Unfortunately, sometimes one of the page works properly (I didnt recognize circumstances for this behavior) but if you load another page or refresh current (CTRL+F5) all external links lose its properties and become looks like just a internal link. For example, upload first this page: http://sqlserver-kit.org/en/sql-server-utilities (in my case all looks fine), and second this page: http://sqlserver-kit.org/en/ssms-addins (all links looks same).
Tested on different browser (Mozilla, Chrome, Edge, Android Browsers) and different devices.
Hello,
@ktaranov - my (temporary) solution to cache problem:
public function onPluginsInitialized()
{
if ($this->config->get('plugins.external_links.enabled')) {
// Process contents order according to weight option
$weight = $this->config->get('plugins.external_links.weight', 0);
// Set default events
$events = [
'onTwigInitialized' => ['onTwigInitialized', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0],
'onPageContentProcessed' => ['onPageContentProcessed', $weight]
];
Because there was, I think, wrong events order - viz https://learn.getgrav.org/plugins/event-hooks#event-order and event onBuildPagesInitialized fires only after first render after cache clearing. So the plugin works only on the first page loaded after cache clearing. Just use debugger breakpoints in event handlers and try clear cache / reload pages.
@Sommerregen I've just started using Grav and I've done / will do a few other modifications and someday maybe I will post a PR. Thank you for this plugin.
Hi, @MartinKavik . Great thanks for your solution, I will try to test it on holidays.
@MartinKavik great thanks - your solution works like a sharm! Could you create a pull request?
@ktaranov Super. Yeah, I'm going to create a PR in next days.
@ktaranov @MartinKavik Thanks guys for your help! Have almost forgotten about this issue.
Hello. Thanks for nice plugin. But in my site with default grav cache enabled plugin stops work (no external icons for links), if i disable cache - plugin start works. Any solution for this issue?