Skip to content

Commit 5d8f643

Browse files
committed
Use home url during crawling and post-processing for Bedrock support
See elementor#840.
1 parent 82317d1 commit 5d8f643

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/Crawler.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ public function crawlSite( string $static_site_path ) : void {
113113
$urls = [];
114114

115115
foreach ( $crawlable_paths as $root_relative_path ) {
116-
$absolute_uri = new URL( $this->site_path . $root_relative_path );
116+
$absolute_uri = new URL(
117+
rtrim( SiteInfo::getURL( 'home' ), '/' ) . $root_relative_path
118+
);
117119
$urls[] = [
118120
'url' => $absolute_uri->get(),
119121
'path' => $root_relative_path,

src/SimpleRewriter.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ public static function rewriteFileContents( string $file_contents ) : string
5050
CoreOptions::getValue( 'deploymentURL' )
5151
);
5252

53-
$wordpress_site_url = apply_filters(
54-
'wp2static_set_wordpress_site_url',
55-
untrailingslashit( SiteInfo::getUrl( 'site' ) )
53+
$wordpress_home_url = apply_filters(
54+
'wp2static_set_wordpress_home_url',
55+
untrailingslashit( SiteInfo::getUrl( 'home' ) )
5656
);
5757

58-
$wordpress_site_url = untrailingslashit( $wordpress_site_url );
58+
$wordpress_home_url = untrailingslashit( $wordpress_home_url );
5959
$destination_url = untrailingslashit( $destination_url );
6060
$destination_url_rel = URLHelper::getProtocolRelativeURL( $destination_url );
6161
$destination_url_rel_c = addcslashes( $destination_url_rel, '/' );
6262

6363
$replacement_patterns = [
64-
$wordpress_site_url => $destination_url,
65-
URLHelper::getProtocolRelativeURL( $wordpress_site_url ) =>
64+
$wordpress_home_url => $destination_url,
65+
URLHelper::getProtocolRelativeURL( $wordpress_home_url ) =>
6666
URLHelper::getProtocolRelativeURL( $destination_url ),
67-
addcslashes( URLHelper::getProtocolRelativeURL( $wordpress_site_url ), '/' ) =>
67+
addcslashes( URLHelper::getProtocolRelativeURL( $wordpress_home_url ), '/' ) =>
6868
addcslashes( URLHelper::getProtocolRelativeURL( $destination_url ), '/' ),
6969
];
7070

0 commit comments

Comments
 (0)