项目作者: Nutr1t07

项目描述 :
Personal static blog generator.
高级语言: Haskell
项目地址: git://github.com/Nutr1t07/gcwdr.git
创建时间: 2020-04-23T14:19:04Z
项目社区:https://github.com/Nutr1t07/gcwdr

开源协议:GNU Lesser General Public License v3.0

下载


gcwdr

(partially implemented)

for each markdown article object, you are able to access these properties in template:

  1. global {
  2. config {
  3. siteTitle: "xxxxx",
  4. siteUrl: "https://xxx.com/",
  5. siteMenus: [{ menuName: "xx", menuLoc: "/xx/xxx" }]
  6. },
  7. partials {
  8. xx1.html: "xxx<xx>xxxx</xx>xxx",
  9. xx2.html: "xxxx"
  10. }
  11. }
  12. this {
  13. title: "xxx",
  14. date: "xxxx-xx-xx",
  15. category: "yy",
  16. template: "xx.html",
  17. relLink: "/xx/xx.html",
  18. content: "blah blah blah..."
  19. // and something else in the meta data of the post markdown file
  20. }
  1. The partials field in global is the raw partial file content. You normally use [- partial xx.html -] to employ them instead of [- global.partials.xx.html -] because the latter one wouldn’t work.
  2. The template field in this is designed for choosing its corresponding template. If there is no template specified in Markdown metadata, it will be default to post.html.
  3. Any entry that extra-added to Markdown metadata will be available to template accessing.

as for the index.html template, it has some different properties:

  1. global: {
  2. config: {
  3. siteTitle: "xxxxx",
  4. siteUrl: "https://xxx.com/",
  5. siteMenus: [{ name: "xx", loc: "/xx/xxx" }]
  6. },
  7. partials: {
  8. xx1.html: "xxx<xx>xxxx</xx>xxx",
  9. xx2.html: "xxxx"
  10. }
  11. }
  12. this: {
  13. posts: [
  14. // each post object has complete properties just as accessings in `post.html`
  15. {
  16. title: "xxx",
  17. date: "xxxx-xx-xx",
  18. category: "yy",
  19. template: "xx.html",
  20. relLink: "/xx/xx.html",
  21. content: "blah blah blah..."
  22. },
  23. {
  24. title: "xxxx",
  25. date: "xxxx-xx-xx",
  26. category: "yyyy",
  27. template: "xx.html",
  28. relLink: "/xx/xx2.html",
  29. content: "blah blah blah..."
  30. }
  31. ],
  32. categories: [
  33. {
  34. cateName: "yy" // name of the category
  35. posts [
  36. {
  37. title: "xxx",
  38. date: "xxxx-xx-xx",
  39. category: "yy",
  40. template: "xx.html",
  41. relLink: "/xx/xx.html",
  42. content: "blah blah blah..."
  43. }
  44. ]
  45. },
  46. {
  47. cateName: "yyyy"
  48. posts: [
  49. {
  50. title: "xxxx",
  51. date: "xxxx-xx-xx",
  52. category: "yy",
  53. template: "xx.html",
  54. relLink: "/xx/xx2.html",
  55. content: "blah blah blah..."
  56. }
  57. ]
  58. }
  59. ]
  60. }

A template example

  1. index.html
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. [- partial head.html -]
  5. <title>[- global.config.siteTitle -]</title>
  6. </head>
  7. <body>
  8. <div class="container">
  9. [- partial sidebar.html -]
  10. <div class="post-list content">
  11. [- foreach y in this.categories -]
  12. <h3>[- y.cateName -]</h3>
  13. [- foreach x in y.posts -]
  14. <li>
  15. <a href="[- x.relLink -]">[- x.title -]</a>
  16. <span class="date"> - [- x.date -]</span>
  17. </li>
  18. [- end -]
  19. [- end -]
  20. </div>
  21. </div>
  22. </body>
  23. </html>
  1. post.html
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. [- partial head.html -]
  5. <title>[- this.title -] | [- global.config.siteTitle -]</title>
  6. </head>
  7. <body>
  8. <div class="container">
  9. [- partial sidebar.html -]
  10. <div class="content">
  11. <h3>[- this.title -]</h3>
  12. [- this.content -]
  13. </div>
  14. </div>
  15. </body>
  16. </html>