wp2static icon indicating copy to clipboard operation
wp2static copied to clipboard

Relative links setting being ignored.

Open pperrin opened this issue 5 years ago • 19 comments

I have no fancy settings - almost all default...

I am creating to a sub-directory on the current site (http(s)://(etc)/staticsite

But although I have checked 'relative links' - despite this all links are fully specified 'http(s)://(etc....).

Setting a 'site url' means that URL is prepended to all links.... and adding a HREF base adds that tag, but makes no difference to the embeded URLs.

pperrin avatar Jan 31 '19 22:01 pperrin

Many thanks for filing these issues, @pperrin. Should be able to dive into relative link functionality soon and cover with unit tests to get it working and stop it breaking (which I think the case is here, likely related to some recent changes to the core URL rewriting mechanisms).

leonstafford avatar Jan 31 '19 22:01 leonstafford

+1 for this issue. I am experiencing the same issue. No matter what setting I choose the generated HTML files don't have relative path.

iloveoss avatar Feb 06 '19 06:02 iloveoss

Any update on this? This issue is causing us some serious problems in development as we're having to regenerate multiple versions for each staging and qa environment, as well as for every developer (due to ports.)

dmeagor avatar Apr 05 '19 12:04 dmeagor

Hi @dmeagor - most issues will not be patched before version 7 release, but then this is one of the priorities.

leonstafford avatar Apr 05 '19 14:04 leonstafford

im generating zip archive and check the box allow offline usage

zip is generated, i extract at download folder and open in browser, page open fines but css is missing.

inspect element reveals errors. failed to load resources, all the links point to home/user/wp-content or offlinezip.wpsho/wpcontent when they should be pointing to home/user/download/zipname/wp-content

minor to fix. just curious why this is happening and what offlinezip.wpsho does

Areahints avatar Aug 01 '19 01:08 Areahints

Any update on this issue? All my alternate and canonical tags are ignored in the static render which is a critical issue for us right now.

meetshah15 avatar Jan 11 '20 08:01 meetshah15

One solution I found is to use Make Relative Path Plugin (on wordpress.org repo). I am using it in conjunction with wp2static and static assets are all having a relative path, just like I wanted.

designgrande avatar Jan 11 '20 17:01 designgrande

Good find. That will help us a lot, thanks!

dmeagor avatar Jan 12 '20 14:01 dmeagor

One solution I found is to use Make Relative Path Plugin (on wordpress.org repo). I am using it in conjunction with wp2static and static assets are all having a relative path, just like I wanted.

Can you explain how you use this?

Do you generate the static site and run this against that? Or run it on the site before you make it static?

i want to freeze some legacy wordpress sites, (but have an off-line backup that I can restore should they ever need to be reactivated as interactive).

pperrin avatar Jan 12 '20 17:01 pperrin

One solution I found is to use Make Relative Path Plugin (on wordpress.org repo). I am using it in conjunction with wp2static and static assets are all having a relative path, just like I wanted.

Can you explain how you use this?

Do you generate the static site and run this against that? Or run it on the site before you make it static?

I want to freeze some legacy WordPress sites, (but have an off-line backup that I can restore should they ever need to be reactivated as interactive).

It's simple actually.

  1. I installed it (make relative path) on my localhost.
  2. Configured it to make only CSS, js & image path relative.
  3. After doing so, I run wp2static (with disabled relative path option in it)
  4. All output HTML files have relative js, CSS and image path - that's exactly what I want.

Hope it helps!

designgrande avatar Jan 12 '20 18:01 designgrande

Thanks - that is great... I wlll give it a go - much appreciated!

pperrin avatar Jan 12 '20 18:01 pperrin

Many thanks, @designgrande!

Will add this to a page of recommended/complimentary plugins.

leonstafford avatar Jan 13 '20 00:01 leonstafford

Hey @leonstafford,

Thanks for the great plugin. Unfortunately, I have the same problem, relative urls feature is broken. When I check Allow offline usage with zip archive mode, I get offlinezip.wpsho in urls. We should not have to use another plugin to make this simple thing work.

trompx avatar Apr 30 '20 15:04 trompx

Hi @trompx, I understand the frustration and it shouldn't require workarounds. Unfortunately, that's going to be the only option today until one/both of the following occur:

  • version 6 is patched (I wasn't going to update V6 again, but there has been enough interest, so starting to fork that off as it's own project to receive updates
  • version 7's rewriting add-on is available (not going to be in the next week, at least)

leonstafford avatar Apr 30 '20 15:04 leonstafford

I am getting the same issue with @trompx

sqiubgl avatar Oct 29 '20 01:10 sqiubgl

I have looked at the code, and this part of it has a lot of 'TO DO' comments - so it is not a bug a such, it is just a feature that has not been completed.

I am looking at a hack to get this working (but no suggesting my change would be worth including in the main product).

I am not sure that an external script (in any old language) to post process the output to change all the links isn't the easiest quick fix.

Are there many people currently waiting for this?

pperrin avatar Oct 29 '20 20:10 pperrin

@pperrin I am. I keep getting http://OFFLINEZIP.wpsho/ in urls related to yoast seo schema, and in some of the image urls as well...

sqiubgl avatar Oct 30 '20 00:10 sqiubgl

I had a bit of a look to see how to progress this (I first raised the issue a very long time ago), and it seems that this project has been replaced with https://github.com/leonstafford/static-html-output -- I only just found this, and the various links in the 'about' and 'readme' pages seem to point all over the place, with some back here and others to a git hub account that has no repositories at all.

I suspect my sites have an old, redundant, unsupported version of this plug in - as thing stand, I don't think any work I do on my sites will help anyone else - and may cause them more problems.

I just wanted this plugin to 'retire' or 'archive' my old wordpress sites - nothing clever.

Sorry, sqiubgl - I think the quickest route for you maybe some clever multifile search/replace to fix up the URL's after this plug in finishes. soz.

pperrin avatar Oct 30 '20 02:10 pperrin

Is there still an option to create relative links ? I believe this issue is actually about the old plugin. I don't see any related option in the current plugin's GUI.

xpufx avatar Mar 18 '23 11:03 xpufx