- 🇬🇧United Kingdom joachim
I've got a quick hack working with an outbound path processor service:
class SiteRootOutboundPathProcessor implements OutboundPathProcessorInterface { /** * {@inheritdoc} */ public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) { if (!$request) { // WTF? Why is $request sometimes NULL? return $path; } if (!$request->attributes->has(StaticGeneratorInterface::REQUEST_KEY)) { return $path; } // Hardcoded for now - should get this value from the base URL option in the form. $options['base_url'] = 'http://localhost:8888/tome-blog/html/tome-blog/web'; return $path; } }
- 🇬🇧United Kingdom joachim
This also isn't working when I try to generate to a domain.
With my site at http://localhost:8888/joachim-blog/htdocs on my local, and generating to https://joachim-n.github.io/, I get:
- the root of the generated at http://localhost:8888/joachim-blog/html/joachim-blog/htdocs/index.html
- the CSS links in the generated HTML have URLs like this: href="/joachim-blog/htdocs/themes/custom/joachim_blog_theme/fonts/metropolis/Metropolis-Regular.woff2" - 🇬🇧United Kingdom joachim
I've tried adding the SiteRootOutboundPathProcessor I posted in an earlier comment, and that doesn't actually fix it -- I don't seem to have pages for path aliases exported at all with that in place!
- 🇬🇧United Kingdom joachim
For entity paths, the problem happens deep in core's UrlGenerator.
Tome's EntityPathSubscriber calls it in the
$event->setPath(parse_url($url->toString(), PHP_URL_PATH));
This has the base URL for the actual site:
$base_url = $this->context->getBaseUrl();
and so returns "/drupal-contrib/web" (I've switched to a different site to experiment since my last comment!)
UrlGenerator then does this, prepending the base URL:
if (!$absolute || !$host = $this->context->getHost()) { $url = $base_url . $path . $query . $fragment;
Then tome's EntityPathSubscriber get this URL for the entity:
> '/drupal-contrib/web/node/1'