<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
/* app/partials/_canonicals.html.twig */
class __TwigTemplate_63dec12142b0e3147dcd7d47915d2a4be6e74209ab14d4a343b690e68ca3d18c extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
private array $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
$this->sandbox = $this->extensions[SandboxExtension::class];
$this->checkSecurity();
}
protected function doDisplay(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "app/partials/_canonicals.html.twig"));
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "app/partials/_canonicals.html.twig"));
// line 4
yield "
<link rel=\"canonical\" href=\"";
// line 5
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl((((CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, ($context["document"] ?? null), "getProperty", ["canonical"], "method", false, true, true, 5), "url", [], "any", true, true, true, 5) && !(null === CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, ($context["document"] ?? null), "getProperty", ["canonical"], "method", false, true, true, 5), "url", [], "any", false, false, true, 5)))) ? (CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, ($context["document"] ?? null), "getProperty", ["canonical"], "method", false, true, true, 5), "url", [], "any", false, false, true, 5)) : (CoreExtension::getAttribute($this->env, $this->source, (isset($context["document"]) || array_key_exists("document", $context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.', 5, $this->source); })()), "url", [], "any", false, false, true, 5)))), "html", null, true);
yield "\"/>
";
// line 7
if (((((CoreExtension::getAttribute($this->env, $this->source, ($context["page"] ?? null), "lang", [], "any", true, true, true, 7) && !(null === CoreExtension::getAttribute($this->env, $this->source, ($context["page"] ?? null), "lang", [], "any", false, false, true, 7)))) ? (CoreExtension::getAttribute($this->env, $this->source, ($context["page"] ?? null), "lang", [], "any", false, false, true, 7)) : (CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 7, $this->source); })()), "request", [], "any", false, false, true, 7), "locale", [], "any", false, false, true, 7))) == "en-gb")) {
// line 8
yield " <link rel=\"alternate\" href=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl($this->sandbox->ensureToStringAllowed(CoreExtension::getAttribute($this->env, $this->source, (isset($context["document"]) || array_key_exists("document", $context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.', 8, $this->source); })()), "url", [], "any", false, false, true, 8), 8, $this->source)), "html", null, true);
yield "\" hreflang=\"x-default\"/>
";
}
// line 10
yield "<link rel=\"alternate\" href=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl($this->sandbox->ensureToStringAllowed(CoreExtension::getAttribute($this->env, $this->source, (isset($context["document"]) || array_key_exists("document", $context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.', 10, $this->source); })()), "url", [], "any", false, false, true, 10), 10, $this->source)), "html", null, true);
yield "\" hreflang=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Twig\Extension\CoreExtension::replace((((CoreExtension::getAttribute($this->env, $this->source, ($context["page"] ?? null), "lang", [], "any", true, true, true, 10) && !(null === CoreExtension::getAttribute($this->env, $this->source, ($context["page"] ?? null), "lang", [], "any", false, false, true, 10)))) ? (CoreExtension::getAttribute($this->env, $this->source, ($context["page"] ?? null), "lang", [], "any", false, false, true, 10)) : (CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 10, $this->source); })()), "request", [], "any", false, false, true, 10), "locale", [], "any", false, false, true, 10))), ["en-gb" => "en"]), "html", null, true);
yield "\"/>
<!-- get_rel_alternate() -->
";
// line 13
$context['_parent'] = $context;
$context['_seq'] = CoreExtension::ensureTraversable($this->extensions['App\Twig\LanguageSwitcherExtension']->getRelAlternate((isset($context["document"]) || array_key_exists("document", $context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.', 13, $this->source); })())));
foreach ($context['_seq'] as $context["lang"] => $context["url"]) {
// line 14
yield " ";
if (($context["lang"] == "en-gb")) {
// line 15
yield " <link rel=\"alternate\" href=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl($this->sandbox->ensureToStringAllowed($context["url"], 15, $this->source)), "html", null, true);
yield "\" hreflang=\"x-default\"/>
";
}
// line 17
yield " <link rel=\"alternate\" href=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl($this->sandbox->ensureToStringAllowed($context["url"], 17, $this->source)), "html", null, true);
yield "\" hreflang=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Twig\Extension\CoreExtension::replace($this->sandbox->ensureToStringAllowed($context["lang"], 17, $this->source), ["en-gb" => "en"]), "html", null, true);
yield "\"/>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['lang'], $context['url'], $context['_parent']);
$context = array_intersect_key($context, $_parent) + $_parent;
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "app/partials/_canonicals.html.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 88 => 17, 82 => 15, 79 => 14, 75 => 13, 66 => 10, 60 => 8, 58 => 7, 53 => 5, 50 => 4,);
}
public function getSourceContext(): Source
{
return new Source("{# Adds canonical for the current page, check if a document property is set named canonical, if not use url of document
Add alternate links for current page as well as for all the possible translations that are set in pimcore.
as the language en-gb is both a audience page as well as the default we add the x-default tag on top of the alternate hreflang=lang #}
<link rel=\"canonical\" href=\"{{ (document.getProperty('canonical').url ?? document.url) | trimUrl }}\"/>
{% if page.lang ?? app.request.locale == \"en-gb\" %}
<link rel=\"alternate\" href=\"{{ document.url | trimUrl }}\" hreflang=\"x-default\"/>
{% endif %}
<link rel=\"alternate\" href=\"{{ document.url | trimUrl }}\" hreflang=\"{{ (page.lang ?? app.request.locale) | replace({'en-gb': 'en'}) }}\"/>
<!-- get_rel_alternate() -->
{% for lang, url in get_rel_alternate(document) %}
{% if lang == \"en-gb\" %}
<link rel=\"alternate\" href=\"{{ url | trimUrl }}\" hreflang=\"x-default\"/>
{% endif %}
<link rel=\"alternate\" href=\"{{ url | trimUrl }}\" hreflang=\"{{ lang | replace({'en-gb': 'en'}) }}\"/>
{% endfor %}
", "app/partials/_canonicals.html.twig", "/home/forge/testing.coolworld.ptchr.dev/templates/app/partials/_canonicals.html.twig");
}
public function checkSecurity()
{
static $tags = ["if" => 7, "for" => 13];
static $filters = ["escape" => 5, "trimUrl" => 5, "replace" => 10];
static $functions = ["get_rel_alternate" => 13];
try {
$this->sandbox->checkSecurity(
['if', 'for'],
['escape', 'trimUrl', 'replace'],
['get_rel_alternate'],
$this->source
);
} catch (SecurityError $e) {
$e->setSourceContext($this->source);
if ($e instanceof SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
}
}