OleVik / grav-plugin-static-generator

Indexing and static generation of Page(s) for Grav.
MIT License
22 stars 1 forks source link

Static pages use wrong images URL #8

Closed pawelandrzejewski89 closed 4 years ago

pawelandrzejewski89 commented 4 years ago

When you generate a static page, the plugin copy images from the content directory to static page directory. In the same time generated static html use images with URL to "$grav root/images/..."

Just for example - I have a blog page with few posts. Plugin generate structure like

\---static
    \---blog
        +---classic-modern-architecture
        |       index.html
        |       unsplash-luca-bravo.jpg
        |
        +---daring-fireball-link
        |       index.html
        |       refuge-des-merveilles-tende-france---denis-degioanni-unsplashcom.jpg
        |
        +---focus-and-blur
        |       index.html
        |       unsplash-focus.jpg

Static content "classic-modern-architecture/index.html" contains URL to

<img src="http://$gravroot/images/u/n/s/p/l/a/unsplash-luca-bravo.jpg>

instead

<img src="/unsplash-luca-bravo.jpg>

Without URL rewriting static content cant exist without grav.

OleVik commented 4 years ago

The plugin does try to rewrite URLs as needed, but I need more data to test edge-cases and various setups. Could you share a .zip-file of the installation this occurs on?

The Source-class needs further optimizing, some of this is happening for v2.0.0. In the end it should capture most supported methods of asset-linking, but it will probably never capture all of them successfully.

OleVik commented 4 years ago

The rewriting has been improved for v2.0.0, please test it and create a new issue if the problem persists with the new version.