指定内容标签
指定内容标签
指定内容标签{soeay:content}用于获取指定ID或自定义URL名称的单篇内容。
基本语法
{soeay:content id=10}
<h1>[soeay:title]</h1>
<p>[soeay:author] | [soeay:date style=Y-m-d] | [soeay:sort_name]</p>
<div class="content">[soeay:content]</div>
{/soeay:content}属性说明
id:内容ID(与filename二选一)filename:自定义URL名称(与id二选一)
可用变量
循环体内支持所有内容字段,常用如下:
| 变量 | 说明 |
|---|---|
| [soeay:i] / [soeay:num] | 序号(固定为 1) |
| [soeay:title] | 标题 |
| [soeay:subtitle] | 副标题 |
| [soeay:content] | 正文(原始HTML) |
| [soeay:author] | 作者 |
| [soeay:source] | 来源 |
| [soeay:link] / [soeay:url] | 详情页链接(自动生成) |
| [soeay:date] / [soeay:time] | 发布时间,可加 style=Y-m-d 格式化 |
| [soeay:ico] | 缩略图 |
| [soeay:sort_name] | 所属栏目名称 |
| [soeay:visits] | 浏览量 |
| [soeay:outlink] | 外链地址(设置外链时) |
| [soeay:description] / [soeay:keywords] | 描述/关键词 |
使用示例
{soeay:content id=54}
<h1>[soeay:title]</h1>
{/soeay:content}
{soeay:content filename=jinriNews}
<h1>[soeay:title]</h1>
{/soeay:content}使用场景
- 在首页或其他页面引用某篇特定文章的部分内容。
- 在侧边栏展示「站长推荐」「关于我们」等固定内容。
- 通过
filename指定内容的自定义 URL 名,避免硬编码 ID。
注意事项
- 必须指定
id或filename其中一个,否则标签不输出。 - 只读取
status=1的已发布内容。 - 循环体内的
[soeay:content]输出原始 HTML,在列表摘要中建议先用drophtml=1去除标签。 - 指定内容的
[soeay:link]会自动生成正确的详情页链接。
