Skip to content

FR add support for images relative to root (starting with /) #4

@hidegh

Description

@hidegh

The solution uses this plugin, but one of the MD does reference an image from the assets, so relatively from root, via: /assets/img/wrong-way.jpg

This makes the build fail, du to the plugin:

`Error` was thrown:
    Error: [Eleventy-Plugin-Page-Assets] Cannot resolve asset "/assets/img/wrong-way.jpg" in "_site/posts/DDD Series - 2 - The history of DDD/index.html" from template "./src/posts/programming/2021-01-05-ddd-series/02/index.md"!
        at C:\$_Work\11ty-custom\node_modules\eleventy-plugin-page-assets\src\plugin.js:80:21

It also results in the MD file not being translated to HTML.

  1. FR: please add support to use images relative to root (starting with /)
  2. BUG: probably a try/catch around the plugin logic would be desirable, so that at least the HTML content gets properly generated (even with a broken IMG link) - still better than having nothing
  3. NOTE: IMO after the const / let issue (see PR fix variable assignment error #2) using directory mode would be probably the best way to approach extra content along the posts (MD files)

11ty-custom.zip


Additionally: when using permalinks post/{title} and fixing the const / let issue in the plugin and using any img copy over, I end up with a weird structure:
image
image

The entire source is attached to play with (debug)...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions