我正在构建自定义主题。我需要覆盖如何呈现博客文章列表以匹配我想要的外观。我似乎无法弄清楚如何呈现博客文章的标题(或任何其他信息)。我的所有标记和硬编码信息都会呈现,但动态数据却没有。
在我的主题文件夹“〜/ Views / Items / Content-BlogPost.cshtml”中:
<div class="media row-fluid">
<div class="span1 hidden-phone">
<!-- Date desktop -->
<div class="date-wrapper"><span class="date-m">Jan</span> <span class="date-d">20</span> </div>
<!-- Meta details desktop -->
<p class="meta muted"><i class="icon-user"></i><a href="#">Alex</a> </p>
</div>
<!-- PROBLEM IS HERE!!!!!!!!!!! Title does not render! -->
<div class="span11"><h1>@Display(Model.Content.Title)</h1>
<div class="media-body">
<div class="tags"><a href="#" class="tag">coding</a> / <a href="#" class="type">event</a></div>
<h4 class="title media-heading"><a href="blog-post.htm">a nec in sed hac ultrices cursus</a></h4>
<!-- Meta details mobile -->
<ul class="inline meta muted visible-phone">
<li><i class="icon-calendar"></i><span class="visible-desktop">Created:</span> Sun 20th Jan 2013</li>
<li><i class="icon-user"></i><a href="#">Alex</a></li>
</ul>
<a href="blog-post.htm" class="media-object">
<img src="img/blog/ape.jpg" alt="Picture of frog by Ben Fredericson">
</a>
<p>@Display(Model.Content)</p>
<ul class="inline links">
<li><a href="blog-post.htm" class="btn btn-mini"><i class="icon-circle-arrow-right"></i>Read more</a></li>
<li><a href="blog-post.htm#comments" class="btn btn-mini"><i class="icon-comment"></i>50 Comments</a></li>
</ul>
</div>
</div>
</div>
答案 0 :(得分:0)
感谢Bertrand,我找到了做到这一点的方法。
Model.ContentItem.TitlePart.Title