47 lines
No EOL
922 B
Markdown
47 lines
No EOL
922 B
Markdown
liquid
|
|
|
|
A templating language have 3 components ie objects, tags and filter
|
|
1. objects are for values of variables. `{{page.title}}` will display value of `page.title`
|
|
2. tags : for control flow
|
|
```html
|
|
{% if page.show_sidebar %}
|
|
<div class="sidebar">
|
|
sidebar content
|
|
</div>
|
|
{% endif %}
|
|
```
|
|
3. fllter : to change output
|
|
eg: `{{ "hi" | capitalize }}` will display `Hi`
|
|
|
|
|
|
**Front matter**
|
|
Front matter is a snippet of YAML placed between two triple-dashed lines at the start of a file.
|
|
- front matter variables
|
|
```
|
|
---
|
|
my_number: 5
|
|
---
|
|
```
|
|
calling value front end matter variable
|
|
```
|
|
{{ page.my_number }}
|
|
```
|
|
example
|
|
```html
|
|
---
|
|
# front matter tells Jekyll to process Liquid
|
|
title: home
|
|
---
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>{{ page.title | capitalize }}</title>
|
|
</head>
|
|
<body>
|
|
<h1>{{ "Hello World!" | downcase }}</h1>
|
|
</body>
|
|
</html>
|
|
|
|
``` |