Blogger在热门帖子中显示外部图片缩略图

时间:2021-07-14 06:50:30

There is a Popular Post Widget provided by Blogger, which can find the popular posts' first image and show it on the sidebar of your blog.

Blogger提供了一个Popular Post Widget,它可以找到热门帖子的第一张图片,并在博客的侧边栏上显示。

But it can only find images which are directly uploaded to Blogger, it doesn't work on external image links. I'm wondering if there's a way to read the external image by editing its code, maybe in javascript I think...

但它只能找到直接上传到Blogger的图片,它不适用于外部图片链接。我想知道是否有办法通过编辑代码来读取外部图像,也许在javascript中我想...

The default generated code:

默认生成的代码:

<!-- (3) Show only thumbnails or (4) Snippets and thumbnails. -->
<div expr:class='data:showSnippets ? &quot;item-content&quot; : &quot;item-thumbnail-only&quot;'>
    <b:if cond='data:post.featuredImage.isResizable or data:post.thumbnail'>
        <div class='item-thumbnail'>
            <a expr:href='data:post.href' target='_blank'>
                <b:with value='data:post.featuredImage.isResizable ? resizeImage(data:post.featuredImage, 72, &quot;1:1&quot;) : data:post.thumbnail' var='image'>
                    <img alt='' border='0' expr:src='data:image'/>
                </b:with>
            </a>
        </div>
    </b:if>
    <div class='item-title'><a expr:href='data:post.href'><data:post.title/></a></div>
    <b:if cond='data:showSnippets'>
        <div class='item-snippet'><data:post.snippet/></div>
    </b:if>
</div>

Since there are so many b:if and data: in the code, I'm not sure if I can treat it as a normal html file or not.

由于有很多b:if和data:在代码中,我不确定我是否可以将它视为普通的html文件。

1 个解决方案

#1


0  

I made a widget below, which can show popular posts' thumbnail by external images. Copy all the code and add it as a widget fixes the problem.

我在下面制作了一个小部件,它可以通过外部图像显示热门帖子的缩略图。复制所有代码并将其添加为小部件来修复问题。

It gets the first image in the posts, both internal images and external images worked well.

它获得了帖子中的第一张图片,内部图片和外部图片都运行良好。

Code: GitHub

#1


0  

I made a widget below, which can show popular posts' thumbnail by external images. Copy all the code and add it as a widget fixes the problem.

我在下面制作了一个小部件,它可以通过外部图像显示热门帖子的缩略图。复制所有代码并将其添加为小部件来修复问题。

It gets the first image in the posts, both internal images and external images worked well.

它获得了帖子中的第一张图片,内部图片和外部图片都运行良好。

Code: GitHub