Closed ItsLhoudini closed 7 years ago
I'm currently working on that
I have found now a "quick & dirty" solution like this:
public function __construct() { $this->seo()->opengraph()->setUrl(URL::current()); }
inside the "main" Controller.php
If my next pull gets accepted, it'll happen within the getCanonical() method automatically
GREAT!
@Lhoudini Lumen doesn't support Facades, so this should be in more agnostic way. @MeestorHok did you figured out?
If anyone is still looking to resolve this:
At the very top of /config/seotools.php:
/**
* Set og:url
* Done this way due to ensure no php warnings are encountered when running artisan commands
* Because 'HTTP_HOST' / 'REQUEST_URI' are available only when using browser
*/
if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
$currentURL = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
} else {
$currentURL = null;
}
return [
'meta' => [ ...
In that same file at 'opengraph' section:
'defaults' => [
'title' => '.........'
'description' => '.........'
'url' => $currentURL,
Hi,
why don't put in defaults value url Url::current() like the canonical one?