elementor / static-html-output

Static HTML Output Plugin for WordPress
https://statichtmloutput.com
The Unlicense
124 stars 33 forks source link

exporting from localhost causes issues. #127

Open MayCXC opened 4 years ago

MayCXC commented 4 years ago

An awesome use case of this plugin is running a wordpress server locally as a development environment, and then deploying the static site from the plugin menu in a browser, in my case to Netlify. But I think that my server setup is making this plugin behave differently than it is supposed to; deploying to Netlify works API wise, but then the site only displays "Page not found," and deploying to a .zip creates an archive with the wordpress installation, but embedded in the absolute path to the directory I am hosting wordpress in:

image

I am using laragon on windows to host. Dragging the "static-html-output" folder from the archive or wp-conten/uploads to the Netlify site "Deploys" page works as intended, so the plugin is creating the static site correctly, just deploying it wrong when hosting wordpress on windows. So, I think somehow this plugin is treating the website root directory as the native windows path to index.php, instead of just the folder index.php is in. Maybe this is for another use case? All I know is that deploying straight to Netlify instead of dragging the folder from uploads to the deploys page would be really slick.

leonstafford commented 4 years ago

Thanks for reporting, @mayhd3. It's an issue with Windows filepaths, which I've started working on a fix for. Now working fine for zip deployment.

Please try the zip in the top of this pull request's comment: https://github.com/WP2Static/static-html-output-plugin/pull/123

I'll merge that into next release once I check/fix the same for other deployments besides zip.

leonstafford commented 4 years ago

Just to clarify, this build: https://github.com/WP2Static/static-html-output-plugin/files/4943854/gulshanwinziptest.zip

MayCXC commented 4 years ago

This fixes the archive and the netlify deploy is working. Sadly the crawler is now missing various .png assets from my theme, and putting their path in the Include box does not seem to do anything about it. So I guess I will have to fix this manually for now.

leonstafford commented 4 years ago

@mayhd3 could you please give some info around what kind of pngs are missing, ideally, the original source in dev site where they are referenced and the output block in the static site if differs?

I think there's an open issue around certain srcset images being ignore from detection open still

MayCXC commented 4 years ago

so I managed to include the theme pngs by putting this line in Include: /wp-content/themes/greydove/assets/images/ this makes \static-html-output\wp-content\themes\greydove\assets\images show up in the deploy folder and fixes the broken part of the theme.

now I am having the same trouble with theme fonts, but the fonts folder does not show up in the deploy folder when I put its path in Include, or even when I put each individual font file in Include.

MayCXC commented 4 years ago

Here is where the images were mentioned in the source and deployed style.css:

.site-header {
    background-color: rgba(255,255,255,0.1);
    background-image: url('assets/images/bg-grunge.png'); // <----------- here
    background-repeat: repeat-x;
    padding: 0 0;
    margin-bottom: 3em;
}

I made a few posts about the fonts, but the css is actually working fine, I need to find where the font files themselves are mentioned.

MayCXC commented 4 years ago

Okay, the fonts are being referred to by /wp-content/themes/greydove/assets/css/fontawesome.min.css?ver=4.7.0 which is getting deployed, but https://XXXXXXX.XXX/wp-content/themes/greydove/assets/fonts/fontawesome-webfont.ttf?v=4.7.0 https://XXXXXXX.XXX/wp-content/themes/greydove/assets/fonts/fontawesome-webfont.ttf?v=4.7.0 and https://XXXXXXX.XXX/wp-content/themes/greydove/assets/fonts/fontawesome-webfont.woff2?v=4.7.0 all 404 on the deployed server. The url is correct, those paths are just empty.

MayCXC commented 4 years ago

on a final note, using wp2static with the patched ArchiveProcessor deploys without issue and crawls the missing images and fonts without any coaxing, so for the time being it looks like I am using frankenphp. Hopefully this lead gets you somewhere, and thank you for maintaining this.

leonstafford commented 4 years ago

Thanks for all your time in reporting these issues, @mayhd3. Sorry, I've still been out of action again too long.

When you mentioned the modified ArchiveProcessor - where can I find that?

Hopefully the missing relative image linked from CSS isn't a big fix - thought it was working and covered with automated tests, but may need more work.

MayCXC commented 4 years ago

This patch: https://github.com/WP2Static/static-html-output-plugin/pull/123/commits/e49eb620a8da5cbe4830332c35371d2b7acd7195#diff-dffd6a565cd8396bc83d0bcf95b0126a But applied to the file in wp2static (not this plugin) is what works for me.

Dogsbreath1 commented 3 years ago

I am having the same problem as @mayhd3 , fonts are not being included. I've tried adding these paths to the ADD URL box:

/wp-content/themes/astra/assets/fonts /wp-content/plugins/elementor/assets/lib/eicons/fonts/ /wp-content/themes/astra/assets/fonts/astra.svg

but neither the folders nor the individual fonts are added for some reason. I am using 6.6.21. I've tired with and without trailing slash for the folder.

Be great to find a solution, but thanks a million for such a great plugin.

leonstafford commented 3 years ago

@Dogsbreath1, can you send your export log and crawl logs? (just check no sensitive information in them)

That may show some more explanation

Dogsbreath1 commented 3 years ago

@Dogsbreath1, can you send your export log and crawl logs? (just check no sensitive information in them)

That may show some more explanation

I just emailed you the 2 logs directly. Many thanks!