在Blogger中发布可点击的帖子 [英] Post clickable in Blogger
问题描述
问题:要访问帖子页面,我只需要单击帖子标题即可.
Issue: To access the post page I have to click on the post title only.
强迫性:单击帖子中的任意位置以转到帖子页面.
Objetive: Click anywhere in the post to go to the post page.
主要元素:
邮寄表格:<div class='date-outer'>
标题:<h2 class='date-header'>
帖子描述:<div class='date-posts'>
Post form : <div class='date-outer'>
Header : <h2 class='date-header'>
Post description : <div class='date-posts'>
问题出在以下代码中:
<!-- posts -->
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.isDateStart and not data:post.isFirstPost'>
</div></div>
</b:if>
<b:if cond='data:post.isDateStart'>
<div class="date-outer">
</b:if>
<b:if cond='data:post.dateHeader'>
<h2 class='date-header'><span><data:post.dateHeader/></span></h2>
</b:if>
<b:if cond='data:post.isDateStart'>
<div class="date-posts">
</b:if>
<div class='post-outer'>
<b:include data='post' name='post'/>
<b:include cond='data:blog.pageType in {"static_page","item"}' data='post' name='comment_picker'/>
</div>
<!-- Ad -->
<b:if cond='data:post.includeAd'>
<div class='inline-ad'>
<data:adCode/>
</div>
</b:if>
</b:loop>
<b:if cond='data:numPosts != 0'>
</div></div>
</b:if>
</div>
前面的代码定义了具有date-outer
的元素和结构,因此当我运行代码时,我得到以下结构:
The previous code defines the elements and the structure that will have date-outer
, so when I run the code I get the following structure:
<div class='blog-posts hfeed'>
<div class='date-outer'>
<h2 class='date-header'>...</h2>
<div class='date-posts'>...</div>
</div>
</div>
在Google Chrome浏览器中检查博客时,我得到了上面的代码段.
I get the above code snippet when I inspect my blog in Google Chrome.
但是要实现我的目标,我需要嵌入一个包含date-header
和date-posts
的链接,如下所示:
But to achieve my goal I need to embed a link containing date-header
and date-posts
, like this:
<div class='blog-posts hfeed'>
<div class='date-outer'>
<a href='X'>
<h2 class='date-header'>...</h2>
<div class='date-posts'>...</div>
</a>
</div>
</div>
-------------------------------------------- -我尝试过----------------------------------------------
我尝试放置:
--------------------------------------------- My tried ----------------------------------------------
I tried placing:
<a expr:href='data:post.link ? data:post.link : data:post.url'>
上一个元素在执行时会生成指向帖子页面的永久链接.
The previous element when executed generates the permanent link to the post page.
代码后:
<b:if cond='data:post.isDateStart'>
<div class="date-outer">
</b:if>
并在代码后使用</a>
将其关闭:
And closing it with </a>
after the code:
<div class='post-outer'>
<b:include data='post' name='post'/>
<b:include cond='data:blog.pageType in {"static_page","item"}' data='post' name='comment_picker'/>
</div>
例如:
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.isDateStart and not data:post.isFirstPost'>
</div></div>
</b:if>
<b:if cond='data:post.isDateStart'>
<div class="date-outer">
</b:if>
<a expr:href='data:post.link ? data:post.link : data:post.url'>
<b:if cond='data:post.dateHeader'>
<h2 class='date-header'><span><data:post.dateHeader/></span></h2>
</b:if>
<b:if cond='data:post.isDateStart'>
<div class="date-posts">
</b:if>
<div class='post-outer'>
<b:include data='post' name='post'/>
<b:include cond='data:blog.pageType in {"static_page","item"}' data='post' name='comment_picker'/>
</div>
</a>
但是我只能在<a>
中包含date-header
:
<div class='blog-posts hfeed'>
<div class='date-outer'>
<a href='X'>
<h2 class='date-header'>...</h2>
</a>
<div class='date-posts'>...</div>
</div>
</div>
我能做什么?
推荐答案
我找到了适合我的解决方案.我共享指向找到解决方案的问题的链接.
I found a solution that works for me. I share the link to the question where the solution is found.
https://stackoverflow.com/a/58308988/7287197
这篇关于在Blogger中发布可点击的帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!