title: 页面变量

description: 每个页面所返回的变量

首页(index.ftl)

访问路径:http://yourdomain

posts(List)

语法

  1. <#list posts.content as post>
  2. // do something
  3. </#list>

参数

  1. [{
  2. "content": [{
  3. "categories": [{
  4. "createTime": "2020-10-13T13:23:39.143Z",
  5. "description": "string",
  6. "fullPath": "string",
  7. "id": 0,
  8. "name": "string",
  9. "parentId": 0,
  10. "slug": "string",
  11. "thumbnail": "string"
  12. }],
  13. "commentCount": 0,
  14. "createTime": "2020-10-13T13:23:39.143Z",
  15. "disallowComment": true,
  16. "editTime": "2020-10-13T13:23:39.143Z",
  17. "editorType": "MARKDOWN",
  18. "fullPath": "string",
  19. "id": 0,
  20. "likes": 0,
  21. "metaDescription": "string",
  22. "metaKeywords": "string",
  23. "metas": {},
  24. "password": "string",
  25. "slug": "string",
  26. "status": "PUBLISHED",
  27. "summary": "string",
  28. "tags": [{
  29. "createTime": "2020-10-13T13:23:39.143Z",
  30. "fullPath": "string",
  31. "id": 0,
  32. "name": "string",
  33. "slug": "string",
  34. "thumbnail": "string"
  35. }],
  36. "template": "string",
  37. "thumbnail": "string",
  38. "title": "string",
  39. "topPriority": 0,
  40. "topped": true,
  41. "updateTime": "2020-10-13T13:23:39.143Z",
  42. "visits": 0,
  43. "wordCount": 0
  44. }],
  45. "empty": true,
  46. "first": true,
  47. "last": true,
  48. "number": 0,
  49. "numberOfElements": 0,
  50. "pageable": {
  51. "page": 0,
  52. "size": 0,
  53. "sort": [
  54. "string"
  55. ]
  56. },
  57. "size": 0,
  58. "sort": {
  59. "sort": [
  60. "string"
  61. ]
  62. },
  63. "totalElements": 0,
  64. "totalPages": 0
  65. }]

示例

遍历输出首页的文章:

  1. <#list posts.content as post>
  2. <a href="${post.fullPath!}">${post.title!}</a>
  3. </#list>

输出:

  1. <a href="http://localhost:8090/archives/url1">title1</a>
  2. <a href="http://localhost:8090/archives/url2">title2</a>
  3. <a href="http://localhost:8090/archives/url3">title3</a>

文章页面(post.ftl)

访问路径不固定,视固定链接配置而定,目前可以配置的有:

  • http://yourdomain/archives/{slug}(默认)
  • http://yourdomain/1970/01/{slug}
  • http://yourdomain/1970/01/01/{slug}
  • http://yourdomain/?p={id}
  • http://yourdomain/archives/{id}

post(Object)

语法

  1. ${post.attribute}

注:attribute 代表具体属性。

参数

  1. {
  2. "categories": [
  3. {
  4. "createTime": "2021-02-25T13:15:58.589Z",
  5. "description": "string",
  6. "fullPath": "string",
  7. "id": 0,
  8. "name": "string",
  9. "parentId": 0,
  10. "password": "string",
  11. "slug": "string",
  12. "thumbnail": "string"
  13. }
  14. ],
  15. "categoryIds": [
  16. 0
  17. ],
  18. "commentCount": 0,
  19. "createTime": "2021-02-25T13:15:58.589Z",
  20. "disallowComment": true,
  21. "editTime": "2021-02-25T13:15:58.589Z",
  22. "editorType": "MARKDOWN",
  23. "formatContent": "string",
  24. "fullPath": "string",
  25. "id": 0,
  26. "likes": 0,
  27. "metaDescription": "string",
  28. "metaIds": [
  29. 0
  30. ],
  31. "metaKeywords": "string",
  32. "metas": [
  33. {
  34. "createTime": "2021-02-25T13:15:58.589Z",
  35. "id": 0,
  36. "key": "string",
  37. "postId": 0,
  38. "value": "string"
  39. }
  40. ],
  41. "originalContent": "string",
  42. "password": "string",
  43. "slug": "string",
  44. "status": "DRAFT",
  45. "summary": "string",
  46. "tagIds": [
  47. 0
  48. ],
  49. "tags": [
  50. {
  51. "createTime": "2021-02-25T13:15:58.589Z",
  52. "fullPath": "string",
  53. "id": 0,
  54. "name": "string",
  55. "slug": "string",
  56. "thumbnail": "string"
  57. }
  58. ],
  59. "template": "string",
  60. "thumbnail": "string",
  61. "title": "string",
  62. "topPriority": 0,
  63. "topped": true,
  64. "updateTime": "2021-02-25T13:15:58.589Z",
  65. "visits": 0,
  66. "wordCount": 0
  67. }

示例

获取文章标题:

  1. <span>${post.title!}</span>

输出:

  1. <span>示例文章</span>

prevPost(Object)

语法

  1. ${prevPost.attribute}

注:attribute 代表具体属性。

参数

  1. {
  2. "categories": [
  3. {
  4. "createTime": "2021-02-25T13:15:58.589Z",
  5. "description": "string",
  6. "fullPath": "string",
  7. "id": 0,
  8. "name": "string",
  9. "parentId": 0,
  10. "password": "string",
  11. "slug": "string",
  12. "thumbnail": "string"
  13. }
  14. ],
  15. "categoryIds": [
  16. 0
  17. ],
  18. "commentCount": 0,
  19. "createTime": "2021-02-25T13:15:58.589Z",
  20. "disallowComment": true,
  21. "editTime": "2021-02-25T13:15:58.589Z",
  22. "editorType": "MARKDOWN",
  23. "formatContent": "string",
  24. "fullPath": "string",
  25. "id": 0,
  26. "likes": 0,
  27. "metaDescription": "string",
  28. "metaIds": [
  29. 0
  30. ],
  31. "metaKeywords": "string",
  32. "metas": [
  33. {
  34. "createTime": "2021-02-25T13:15:58.589Z",
  35. "id": 0,
  36. "key": "string",
  37. "postId": 0,
  38. "value": "string"
  39. }
  40. ],
  41. "originalContent": "string",
  42. "password": "string",
  43. "slug": "string",
  44. "status": "DRAFT",
  45. "summary": "string",
  46. "tagIds": [
  47. 0
  48. ],
  49. "tags": [
  50. {
  51. "createTime": "2021-02-25T13:15:58.589Z",
  52. "fullPath": "string",
  53. "id": 0,
  54. "name": "string",
  55. "slug": "string",
  56. "thumbnail": "string"
  57. }
  58. ],
  59. "template": "string",
  60. "thumbnail": "string",
  61. "title": "string",
  62. "topPriority": 0,
  63. "topped": true,
  64. "updateTime": "2021-02-25T13:15:58.589Z",
  65. "visits": 0,
  66. "wordCount": 0
  67. }

示例

获取上一篇文章的信息:

  1. <#if prevPost??>
  2. <a href="${prevPost.fullPath!}">上一篇:${prevPost.title!}</a>
  3. </#if>

输出:

  1. <a href="http://localhost:8090/archives/url1">上一篇:title1</a>

nextPost(Object)

语法

  1. ${nextPost.attribute}

注:attribute 代表具体属性。

参数

  1. {
  2. "categories": [
  3. {
  4. "createTime": "2021-02-25T13:15:58.589Z",
  5. "description": "string",
  6. "fullPath": "string",
  7. "id": 0,
  8. "name": "string",
  9. "parentId": 0,
  10. "password": "string",
  11. "slug": "string",
  12. "thumbnail": "string"
  13. }
  14. ],
  15. "categoryIds": [
  16. 0
  17. ],
  18. "commentCount": 0,
  19. "createTime": "2021-02-25T13:15:58.589Z",
  20. "disallowComment": true,
  21. "editTime": "2021-02-25T13:15:58.589Z",
  22. "editorType": "MARKDOWN",
  23. "formatContent": "string",
  24. "fullPath": "string",
  25. "id": 0,
  26. "likes": 0,
  27. "metaDescription": "string",
  28. "metaIds": [
  29. 0
  30. ],
  31. "metaKeywords": "string",
  32. "metas": [
  33. {
  34. "createTime": "2021-02-25T13:15:58.589Z",
  35. "id": 0,
  36. "key": "string",
  37. "postId": 0,
  38. "value": "string"
  39. }
  40. ],
  41. "originalContent": "string",
  42. "password": "string",
  43. "slug": "string",
  44. "status": "DRAFT",
  45. "summary": "string",
  46. "tagIds": [
  47. 0
  48. ],
  49. "tags": [
  50. {
  51. "createTime": "2021-02-25T13:15:58.589Z",
  52. "fullPath": "string",
  53. "id": 0,
  54. "name": "string",
  55. "slug": "string",
  56. "thumbnail": "string"
  57. }
  58. ],
  59. "template": "string",
  60. "thumbnail": "string",
  61. "title": "string",
  62. "topPriority": 0,
  63. "topped": true,
  64. "updateTime": "2021-02-25T13:15:58.589Z",
  65. "visits": 0,
  66. "wordCount": 0
  67. }

示例

获取下一篇文章的信息:

  1. <#if nextPost??>
  2. <a href="${nextPost.fullPath!}">下一篇:${nextPost.title!}</a>
  3. </#if>

输出:

  1. <a href="http://localhost:8090/archives/url3">下一篇:title3</a>

categories(List)

语法

  1. <#list categories as category>
  2. // do something
  3. </#list>

参数

  1. [{
  2. "createTime": "2021-02-25T13:32:11.189Z",
  3. "description": "string",
  4. "fullPath": "string",
  5. "id": 0,
  6. "name": "string",
  7. "parentId": 0,
  8. "password": "string",
  9. "slug": "string",
  10. "thumbnail": "string"
  11. }]

示例

获取文章的分类列表:

  1. <#list categories as category>
  2. <a href="${category.fullPath!}">${category.name!}</a>
  3. </#list>

输出:

  1. <a href="http://localhost:8090/categories/url1">name1</a>
  2. <a href="http://localhost:8090/categories/url2">name2</a>

tags(List)

语法

  1. <#list tags as tag>
  2. // do something
  3. </#list>

参数

  1. [{
  2. "createTime": "2021-02-25T13:34:48.779Z",
  3. "fullPath": "string",
  4. "id": 0,
  5. "name": "string",
  6. "slug": "string",
  7. "thumbnail": "string"
  8. }]

示例

获取文章的标签列表:

  1. <#list tags as tag>
  2. <a href="${tag.fullPath!}">${tag.name!}</a>
  3. </#list>

输出:

  1. <a href="http://localhost:8090/tags/url1">name1</a>
  2. <a href="http://localhost:8090/tags/url2">name2</a>

metas(Object)

语法

  1. ${metas.key}

注:attribute 代表具体 key 值。

参数

示例

获取用户设置的音乐链接:

  1. <audio src="${metas.music_url}" controls="controls"></audio>

输出:

  1. <audio src="/music.mp3" controls="controls"></audio>

自定义页面(sheet.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/s/{slug}

sheet(Object)

语法

  1. ${sheet.attribute}

注:attribute 代表具体属性。

参数

  1. {
  2. "commentCount": 0,
  3. "createTime": "2021-02-25T13:37:29.775Z",
  4. "disallowComment": true,
  5. "editTime": "2021-02-25T13:37:29.775Z",
  6. "editorType": "MARKDOWN",
  7. "formatContent": "string",
  8. "fullPath": "string",
  9. "id": 0,
  10. "likes": 0,
  11. "metaDescription": "string",
  12. "metaIds": [
  13. 0
  14. ],
  15. "metaKeywords": "string",
  16. "metas": [
  17. {
  18. "createTime": "2021-02-25T13:37:29.775Z",
  19. "id": 0,
  20. "key": "string",
  21. "postId": 0,
  22. "value": "string"
  23. }
  24. ],
  25. "originalContent": "string",
  26. "password": "string",
  27. "slug": "string",
  28. "status": "DRAFT",
  29. "summary": "string",
  30. "template": "string",
  31. "thumbnail": "string",
  32. "title": "string",
  33. "topPriority": 0,
  34. "topped": true,
  35. "updateTime": "2021-02-25T13:37:29.775Z",
  36. "visits": 0,
  37. "wordCount": 0
  38. }

示例

获取页面标题:

  1. <span>${sheet.title!}</span>

输出:

  1. <span>示例页面</span>

metas(Object)

语法

  1. ${metas.key}

注:attribute 代表具体 key 值。

参数

示例

获取用户设置的音乐链接:

  1. <audio src="${metas.music_url}" controls="controls"></audio>

输出:

  1. <audio src="/music.mp3" controls="controls"></audio>

文章归档页面(archives.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/archives

posts(List)

语法

  1. <#list posts.content as post>
  2. // do something
  3. </#list>

参数

  1. [{
  2. "content": [{
  3. "categories": [{
  4. "createTime": "2020-10-13T13:23:39.143Z",
  5. "description": "string",
  6. "fullPath": "string",
  7. "id": 0,
  8. "name": "string",
  9. "parentId": 0,
  10. "slug": "string",
  11. "thumbnail": "string"
  12. }],
  13. "commentCount": 0,
  14. "createTime": "2020-10-13T13:23:39.143Z",
  15. "disallowComment": true,
  16. "editTime": "2020-10-13T13:23:39.143Z",
  17. "editorType": "MARKDOWN",
  18. "fullPath": "string",
  19. "id": 0,
  20. "likes": 0,
  21. "metaDescription": "string",
  22. "metaKeywords": "string",
  23. "metas": {},
  24. "password": "string",
  25. "slug": "string",
  26. "status": "PUBLISHED",
  27. "summary": "string",
  28. "tags": [{
  29. "createTime": "2020-10-13T13:23:39.143Z",
  30. "fullPath": "string",
  31. "id": 0,
  32. "name": "string",
  33. "slug": "string",
  34. "thumbnail": "string"
  35. }],
  36. "template": "string",
  37. "thumbnail": "string",
  38. "title": "string",
  39. "topPriority": 0,
  40. "topped": true,
  41. "updateTime": "2020-10-13T13:23:39.143Z",
  42. "visits": 0,
  43. "wordCount": 0
  44. }],
  45. "empty": true,
  46. "first": true,
  47. "last": true,
  48. "number": 0,
  49. "numberOfElements": 0,
  50. "pageable": {
  51. "page": 0,
  52. "size": 0,
  53. "sort": [
  54. "string"
  55. ]
  56. },
  57. "size": 0,
  58. "sort": {
  59. "sort": [
  60. "string"
  61. ]
  62. },
  63. "totalElements": 0,
  64. "totalPages": 0
  65. }]

示例

遍历输出归档页面的文章(无年份分组):

  1. <#list posts.content as post>
  2. <a href="${post.fullPath!}">${post.title!}</a>
  3. </#list>

输出:

  1. <a href="http://localhost:8090/archives/url1">title1</a>
  2. <a href="http://localhost:8090/archives/url2">title2</a>
  3. <a href="http://localhost:8090/archives/url3">title3</a>

archives(List)

语法

  1. <#list archives.content as archive>
  2. // do something
  3. </#list>

参数

  1. {
  2. "content": [{
  3. "posts": [{
  4. "categories": [{
  5. "createTime": "2021-03-07T05:45:06.271Z",
  6. "description": "string",
  7. "fullPath": "string",
  8. "id": 0,
  9. "name": "string",
  10. "parentId": 0,
  11. "password": "string",
  12. "slug": "string",
  13. "thumbnail": "string"
  14. }],
  15. "commentCount": 0,
  16. "createTime": "2021-03-07T05:45:06.271Z",
  17. "disallowComment": true,
  18. "editTime": "2021-03-07T05:45:06.271Z",
  19. "editorType": "MARKDOWN",
  20. "fullPath": "string",
  21. "id": 0,
  22. "likes": 0,
  23. "metaDescription": "string",
  24. "metaKeywords": "string",
  25. "metas": {},
  26. "password": "string",
  27. "slug": "string",
  28. "status": "DRAFT",
  29. "summary": "string",
  30. "tags": [{
  31. "createTime": "2021-03-07T05:45:06.271Z",
  32. "fullPath": "string",
  33. "id": 0,
  34. "name": "string",
  35. "slug": "string",
  36. "thumbnail": "string"
  37. }],
  38. "template": "string",
  39. "thumbnail": "string",
  40. "title": "string",
  41. "topPriority": 0,
  42. "topped": true,
  43. "updateTime": "2021-03-07T05:45:06.271Z",
  44. "visits": 0,
  45. "wordCount": 0
  46. }],
  47. "year": 0
  48. }],
  49. "hasContent": true,
  50. "hasNext": true,
  51. "hasPrevious": true,
  52. "isEmpty": true,
  53. "isFirst": true,
  54. "page": 0,
  55. "pages": 0,
  56. "rpp": 0,
  57. "total": 0
  58. }

示例

遍历输出归档页面的文章(有年份分组):

  1. <#list archives.content as archive>
  2. <h1>${archive.year?c}</h1>
  3. <#list archive.posts as post>
  4. <a href="${post.fullPath!}">${post.title!}</a>
  5. </#list>
  6. </#list>

输出:

  1. <h1>2021</h1>
  2. <a href="http://localhost:8090/archives/url1">title1</a>
  3. <a href="http://localhost:8090/archives/url2">title2</a>
  4. <a href="http://localhost:8090/archives/url3">title3</a>
  5. <h1>2020</h1>
  6. <a href="http://localhost:8090/archives/url4">title4</a>
  7. <a href="http://localhost:8090/archives/url5">title5</a>
  8. <a href="http://localhost:8090/archives/url6">title6</a>

分类目录页面(categories.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/categories

此页面无页面变量,可以使用 模板标签 获取分类列表。

单个分类所属文章页面(category.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/categories/{slug}

posts(List)

语法

  1. <#list posts.content as post>
  2. // do something
  3. </#list>

参数

  1. [{
  2. "content": [{
  3. "categories": [{
  4. "createTime": "2020-10-13T13:23:39.143Z",
  5. "description": "string",
  6. "fullPath": "string",
  7. "id": 0,
  8. "name": "string",
  9. "parentId": 0,
  10. "slug": "string",
  11. "thumbnail": "string"
  12. }],
  13. "commentCount": 0,
  14. "createTime": "2020-10-13T13:23:39.143Z",
  15. "disallowComment": true,
  16. "editTime": "2020-10-13T13:23:39.143Z",
  17. "editorType": "MARKDOWN",
  18. "fullPath": "string",
  19. "id": 0,
  20. "likes": 0,
  21. "metaDescription": "string",
  22. "metaKeywords": "string",
  23. "metas": {},
  24. "password": "string",
  25. "slug": "string",
  26. "status": "PUBLISHED",
  27. "summary": "string",
  28. "tags": [{
  29. "createTime": "2020-10-13T13:23:39.143Z",
  30. "fullPath": "string",
  31. "id": 0,
  32. "name": "string",
  33. "slug": "string",
  34. "thumbnail": "string"
  35. }],
  36. "template": "string",
  37. "thumbnail": "string",
  38. "title": "string",
  39. "topPriority": 0,
  40. "topped": true,
  41. "updateTime": "2020-10-13T13:23:39.143Z",
  42. "visits": 0,
  43. "wordCount": 0
  44. }],
  45. "empty": true,
  46. "first": true,
  47. "last": true,
  48. "number": 0,
  49. "numberOfElements": 0,
  50. "pageable": {
  51. "page": 0,
  52. "size": 0,
  53. "sort": [
  54. "string"
  55. ]
  56. },
  57. "size": 0,
  58. "sort": {
  59. "sort": [
  60. "string"
  61. ]
  62. },
  63. "totalElements": 0,
  64. "totalPages": 0
  65. }]

示例

遍历输出某个分类的文章:

  1. <#list posts.content as post>
  2. <a href="${post.fullPath!}">${post.title!}</a>
  3. </#list>

输出:

  1. <a href="http://localhost:8090/archives/url1">title1</a>
  2. <a href="http://localhost:8090/archives/url2">title2</a>
  3. <a href="http://localhost:8090/archives/url3">title3</a>

category(Object)

语法

  1. ${category.attribute}

注:attribute 代表具体属性。

参数

  1. {
  2. "createTime": "2020-10-11T05:59:40.622Z",
  3. "description": "string",
  4. "fullPath": "string",
  5. "id": 0,
  6. "name": "string",
  7. "parentId": 0,
  8. "slug": "string",
  9. "thumbnail": "string",
  10. "postCount": 0
  11. }

示例

  1. <a href="${category.fullPath!}">分类:${category.name!}</a>

输出:

  1. <a href="http://localhost:8090/categories/url1">分类:name1</a>

标签页面(tags.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/tags

此页面无页面变量,可以使用 模板标签 获取标签列表。

单个标签所属文章页面(tag.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/tags/{slug}

posts(List)

语法

  1. <#list posts.content as post>
  2. // do something
  3. </#list>

参数

  1. [{
  2. "content": [{
  3. "categories": [{
  4. "createTime": "2020-10-13T13:23:39.143Z",
  5. "description": "string",
  6. "fullPath": "string",
  7. "id": 0,
  8. "name": "string",
  9. "parentId": 0,
  10. "slug": "string",
  11. "thumbnail": "string"
  12. }],
  13. "commentCount": 0,
  14. "createTime": "2020-10-13T13:23:39.143Z",
  15. "disallowComment": true,
  16. "editTime": "2020-10-13T13:23:39.143Z",
  17. "editorType": "MARKDOWN",
  18. "fullPath": "string",
  19. "id": 0,
  20. "likes": 0,
  21. "metaDescription": "string",
  22. "metaKeywords": "string",
  23. "metas": {},
  24. "password": "string",
  25. "slug": "string",
  26. "status": "PUBLISHED",
  27. "summary": "string",
  28. "tags": [{
  29. "createTime": "2020-10-13T13:23:39.143Z",
  30. "fullPath": "string",
  31. "id": 0,
  32. "name": "string",
  33. "slug": "string",
  34. "thumbnail": "string"
  35. }],
  36. "template": "string",
  37. "thumbnail": "string",
  38. "title": "string",
  39. "topPriority": 0,
  40. "topped": true,
  41. "updateTime": "2020-10-13T13:23:39.143Z",
  42. "visits": 0,
  43. "wordCount": 0
  44. }],
  45. "empty": true,
  46. "first": true,
  47. "last": true,
  48. "number": 0,
  49. "numberOfElements": 0,
  50. "pageable": {
  51. "page": 0,
  52. "size": 0,
  53. "sort": [
  54. "string"
  55. ]
  56. },
  57. "size": 0,
  58. "sort": {
  59. "sort": [
  60. "string"
  61. ]
  62. },
  63. "totalElements": 0,
  64. "totalPages": 0
  65. }]

示例

遍历输出某个标签的文章:

  1. <#list posts.content as post>
  2. <a href="${post.fullPath!}">${post.title!}</a>
  3. </#list>

输出:

  1. <a href="http://localhost:8090/archives/url1">title1</a>
  2. <a href="http://localhost:8090/archives/url2">title2</a>
  3. <a href="http://localhost:8090/archives/url3">title3</a>

tag(Object)

语法

  1. ${tag.attribute}

注:attribute 代表具体属性。

参数

  1. {
  2. "createTime": "2020-10-11T06:14:30.595Z",
  3. "fullPath": "string",
  4. "id": 0,
  5. "name": "string",
  6. "slug": "string",
  7. "thumbnail": "string"
  8. }

示例

  1. <a href="${tag.fullPath!}">标签:${tag.name!}</a>

输出:

  1. <a href="http://localhost:8090/tags/url1">标签:name1</a>

文章搜索结果页面(search.ftl)

访问路径:http://yourdomain/search?keyword=keyword

keyword(String)

语法

  1. ${keyword!}

参数

示例

  1. 搜索关键字为:${keyword!}

posts(List)

语法

  1. <#list posts.content as post>
  2. // do something
  3. </#list>

参数

  1. [{
  2. "content": [{
  3. "categories": [{
  4. "createTime": "2020-10-13T13:23:39.143Z",
  5. "description": "string",
  6. "fullPath": "string",
  7. "id": 0,
  8. "name": "string",
  9. "parentId": 0,
  10. "slug": "string",
  11. "thumbnail": "string"
  12. }],
  13. "commentCount": 0,
  14. "createTime": "2020-10-13T13:23:39.143Z",
  15. "disallowComment": true,
  16. "editTime": "2020-10-13T13:23:39.143Z",
  17. "editorType": "MARKDOWN",
  18. "fullPath": "string",
  19. "id": 0,
  20. "likes": 0,
  21. "metaDescription": "string",
  22. "metaKeywords": "string",
  23. "metas": {},
  24. "password": "string",
  25. "slug": "string",
  26. "status": "PUBLISHED",
  27. "summary": "string",
  28. "tags": [{
  29. "createTime": "2020-10-13T13:23:39.143Z",
  30. "fullPath": "string",
  31. "id": 0,
  32. "name": "string",
  33. "slug": "string",
  34. "thumbnail": "string"
  35. }],
  36. "template": "string",
  37. "thumbnail": "string",
  38. "title": "string",
  39. "topPriority": 0,
  40. "topped": true,
  41. "updateTime": "2020-10-13T13:23:39.143Z",
  42. "visits": 0,
  43. "wordCount": 0
  44. }],
  45. "empty": true,
  46. "first": true,
  47. "last": true,
  48. "number": 0,
  49. "numberOfElements": 0,
  50. "pageable": {
  51. "page": 0,
  52. "size": 0,
  53. "sort": [
  54. "string"
  55. ]
  56. },
  57. "size": 0,
  58. "sort": {
  59. "sort": [
  60. "string"
  61. ]
  62. },
  63. "totalElements": 0,
  64. "totalPages": 0
  65. }]

示例

遍历输出某个搜索结果的文章:

  1. <#list posts.content as post>
  2. <a href="${post.fullPath!}">${post.title!}</a>
  3. </#list>

输出:

  1. <a href="http://localhost:8090/archives/url1">title1</a>
  2. <a href="http://localhost:8090/archives/url2">title2</a>
  3. <a href="http://localhost:8090/archives/url3">title3</a>

友情链接页面(links.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/links

此页面无页面变量,可以使用 模板标签 获取友情链接列表。

图库页面(photos.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/photos

photos(List)

语法

  1. <#list photos.content as photo>
  2. // do something
  3. </#list>

参数

  1. {
  2. "content": [{
  3. "description": "string",
  4. "id": 0,
  5. "location": "string",
  6. "name": "string",
  7. "takeTime": "2021-03-07T05:28:12.352Z",
  8. "team": "string",
  9. "thumbnail": "string",
  10. "url": "string"
  11. }],
  12. "hasContent": true,
  13. "hasNext": true,
  14. "hasPrevious": true,
  15. "isEmpty": true,
  16. "isFirst": true,
  17. "page": 0,
  18. "pages": 0,
  19. "rpp": 0,
  20. "total": 0
  21. }

示例

  1. <#list photos.content as photo>
  2. <img alt="${photo.description!}" src="${photo.url!}"/>
  3. </#list>

输出:

  1. <img alt="山川" src="https://youdomain.com/upload/2021/01/1.png"/>
  2. <img alt="河流" src="https://youdomain.com/upload/2021/01/2.png"/>
  3. <img alt="绿树" src="https://youdomain.com/upload/2021/01/3.png"/>

日志页面(journals.ftl)

访问路径不固定,视固定链接配置而定,默认为:http://yourdomain/journals

journals(List)

语法

  1. <#list journals.content as journal>
  2. // do something
  3. </#list>

参数

  1. {
  2. "content": [{
  3. "commentCount": 0,
  4. "content": "string",
  5. "createTime": "2021-03-07T05:32:06.365Z",
  6. "id": 0,
  7. "likes": 0,
  8. "sourceContent": "string",
  9. "type": "INTIMATE"
  10. }],
  11. "hasContent": true,
  12. "hasNext": true,
  13. "hasPrevious": true,
  14. "isEmpty": true,
  15. "isFirst": true,
  16. "page": 0,
  17. "pages": 0,
  18. "rpp": 0,
  19. "total": 0
  20. }

示例

  1. <ul>
  2. <#list journals.content as journal>
  3. <li>
  4. ${journal.createTime?string('yyyy年MM月dd日')}:${journal.content!}
  5. </li>
  6. </#list>
  7. </ul>

输出:

  1. <ul>
  2. <li>
  3. 2021年3月7日:内容1
  4. </li>
  5. <li>
  6. 2021年3月7日:内容2
  7. </li>
  8. </ul>