User Tools

Site Tools


blogging_with_jekyll

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
blogging_with_jekyll [2021/03/22 21:44] – [Output markup] hc9blogging_with_jekyll [2021/03/22 21:46] (current) – [Post template] hc9
Line 58: Line 58:
 ==== Post template ==== ==== Post template ====
  
-''post.html'' determines the layout for post pages. Here we first encounter YAML front matter. YAML stands for "YAML Ain't a Markup Language," Any YAML content is placed between ''<nowiki>---</nowiki>'' and ''<nowiki>---</nowiki>'' (each on their own line) at the beginning of a document. In this front matter we can set variables in the format, "variable: value". The only variable we need to set for the post template is "layout: default". This tells Jekyll to insert this template into ''<nowiki>{{</nowiki> content <nowiki>}}</nowiki>'' in the default layout. We'll also want to add a ''<nowiki>{{</nowiki> content <nowiki>}}</nowiki>'' to the post template. This is where the actual post will get inserted. We also might want to add somethings like ''<nowiki>{{</nowiki> page.title <nowiki>}}</nowiki>'' and ''<nowiki>{{</nowiki> page.date | date: "%A %d %B %Y" <nowiki>}}</nowiki>'', which will format the post's date as ''Weekday Day Month Year''.+''post.html'' determines the layout for post pages. Here we first encounter YAML front matter. YAML stands for "YAML Ain't a Markup Language," Any YAML content is placed between ''<nowiki>---</nowiki>'' and ''<nowiki>---</nowiki>'' (each on their own line) at the beginning of a document. In this front matter we can set variables in the format, ''variable: value''. The only variable we need to set for the post template is ''layout: default''. This tells Jekyll to insert this template into ''<nowiki>{{</nowiki> content <nowiki>}}</nowiki>'' in the default layout. We'll also want to add a ''<nowiki>{{</nowiki> content <nowiki>}}</nowiki>'' to the post template. This is where the actual post will get inserted. We also might want to add somethings like ''<nowiki>{{</nowiki> page.title <nowiki>}}</nowiki>'' and ''<nowiki>{{</nowiki> page.date | date: "%A %d %B %Y" <nowiki>}}</nowiki>'', which will format the post's date as ''Weekday Day Month Year''.
  
 ==== Other templates ==== ==== Other templates ====
blogging_with_jekyll.1616449454.txt.gz · Last modified: 2021/03/22 21:44 by hc9