有特色图片可能吗?

时间:2022-05-17 06:19:50

I'm working on a custom responsive template for Blogger. Since Blogger doesn't have a "featured image" feature like Wordpress, is there a way that I can make the first image embedded in the post appear above the post-body and post-title? is there some kind of if/conditional statement that I can use?

我正在为Blogger开发一个自定义响应模板。既然Blogger没有像Wordpress那样的“特色图片”功能,我是否有办法让嵌入博文中的第一张图片出现在博文的正文和标题之上?我是否可以使用某种if/条件语句?

Or, would it be best for me to HTML the post-title inside the post itself below the first embedded image? However, if I followed that method, how do I make the image within the post link to the post itself without editing it?

或者,对我来说,最好是在第一个嵌入的图像下面的post-title里面使用HTML ?但是,如果我遵循这个方法,如何在不进行编辑的情况下使post链接内的图像指向post本身呢?

Thanks...

谢谢……

1 个解决方案

#1


5  

If you want to grab the first image, you can use make use of the template tag - <data:post.firstImageUrl/>

如果想要获取第一个图像,可以使用模板标签-

Below Example might help you out.

下面的例子可能对您有所帮助。

 <b:if cond='data:post.firstImageUrl'>
 <img expr:src ="data:post.firstImageUrl" expr:alt="data:post.title"/>
 </b:if>

This will work only within the Blogger's Post Loop

这将只在博主的博文循环中有效

Another way of using Featured images will be to use an image link in the enclosures and to edit your template to render enclosure links as featured thumbnails. My Blog post might help you with this (http://www.bloggerplugins.org/2011/09/post-thumbnails-for-blogger.html) . It hasn't been updated for over 2 years, but it might give you some guidance.

使用有特色图片的另一种方式是在附件中使用一个图片链接,并编辑模板,将有特色的缩略图呈现出来。我的博客文章可能对您有所帮助(http://www.bloggerplugins.org/2011/09/post thumbnails-forblogger .html)。它已经有两年多没有更新了,但是它可能会给你一些指导。

#1


5  

If you want to grab the first image, you can use make use of the template tag - <data:post.firstImageUrl/>

如果想要获取第一个图像,可以使用模板标签-

Below Example might help you out.

下面的例子可能对您有所帮助。

 <b:if cond='data:post.firstImageUrl'>
 <img expr:src ="data:post.firstImageUrl" expr:alt="data:post.title"/>
 </b:if>

This will work only within the Blogger's Post Loop

这将只在博主的博文循环中有效

Another way of using Featured images will be to use an image link in the enclosures and to edit your template to render enclosure links as featured thumbnails. My Blog post might help you with this (http://www.bloggerplugins.org/2011/09/post-thumbnails-for-blogger.html) . It hasn't been updated for over 2 years, but it might give you some guidance.

使用有特色图片的另一种方式是在附件中使用一个图片链接,并编辑模板,将有特色的缩略图呈现出来。我的博客文章可能对您有所帮助(http://www.bloggerplugins.org/2011/09/post thumbnails-forblogger .html)。它已经有两年多没有更新了,但是它可能会给你一些指导。