Failed to import third-party images

Hi there,

I am using this repo to create my blog. However the shell occurred an error when I tried to use an image from other domain names. Just like this:

![](https://example.com/1.png)

while not this:

![](/post/example/1.png)

It showed me this:

11:21:34 PM: $ npm run build
11:21:35 PM: > dsr-blog@7.0.2 build
11:21:35 PM: > cross-env NODE_ENV=production env-cmd --silent run-s compile script:minify
11:21:36 PM: > dsr-blog@7.0.2 compile
11:21:36 PM: > hugo --cleanDestinationDir
11:21:36 PM: Start building sites …
11:21:36 PM: hugo v0.85.0-724D5DB5+extended linux/amd64 BuildDate=2021-07-05T10:46:28Z VendorInfo=gohugoio
11:21:36 PM: WARN 2022/02/06 15:21:36 Image not found "https://telegra.ph/file/40d95b5099f43de18afff.jpg"
11:21:36 PM:                    | EN
11:21:36 PM: -------------------+-----
11:21:36 PM:   Pages            | 43
11:21:36 PM:   Paginator pages  |  2
11:21:36 PM:   Non-page files   | 60
11:21:36 PM:   Static files     | 23
11:21:36 PM:   Processed images |  0
11:21:36 PM:   Aliases          |  2
11:21:36 PM:   Sitemaps         |  1
11:21:36 PM:   Cleaned          |  0
11:21:36 PM: Total in 355 ms
11:21:37 PM: > dsr-blog@7.0.2 script:minify
11:21:37 PM: > node "./scripts/minify.mjs"
11:21:37 PM: fetching raw files...
11:21:37 PM: raw files fetched in 42ms
11:21:38 PM: done with css files in 599ms
11:21:40 PM: done with html files in 2643ms
11:21:40 PM: ​
11:21:40 PM: (build.command completed in 5.8s)
11:21:40 PM: Creating deploy upload records

It might be the problem of /layouts/_default/_markup/render-image.html but I have no idea how to fix it.

Concerned post for test: https://github.com/FreshP0325/dsr-blog-1/blob/main/content/post/2022/hello-2022.md

Yes. The template under /layouts/_default/_markup/render-image.html does not handle external images in your project.

Have a look at this post by @jmooring

He has shared a render-image template that renders both external and local images.

Thanks! That definitely helps me a lot. Now I can use external images. That’s excellent!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.