/* Override option * you could also disable it to output a non-relative link, * even when `relative_link` is enabled and vice versa. */ <%- url_for('/css/style.css', {relative: false}) %> // /css/style.css
If you don’t specify the [options] parameter, the default options will apply. Otherwise, you can set it to a number which will then be passed on as the size parameter to Gravatar. Finally, if you set it to an object, it will be converted into a query string of parameters for Gravatar.
Loads CSS files. path can be a string, an array, an object or an array of objects. /<root>/ value is prepended while .css extension is appended to the path automatically. Use object type for custom attributes.
Loads JavaScript files. path can be a string, an array, an object or an array of objects. โหลดไฟล์ JavaScript path นั้นเป็น array หรือ string ได้ ถ้า path นั้นไม่มี / หรือ protocol ใดๆ เป็นคำนำหน้า มันจะมี root URL เป็นคำนำหน้า ถ้าคุณไม่ได้เพิ่ม extension ท่ีเป็น .js หลัง path extension นั้นจะถูกเพิ่มให้ไฟล์โดยอัตโนมัติ Use object type for custom attributes. Use object type for custom attributes.
Loads other template files. โหลดไฟล์ template อื่นๆ คุณสามารถตั้งค่า local variable ใน locals
<%- partial(layout, [locals], [options]) %>
Option
Description
Default
cache
Cache contents (Use fragment cache)
false
only
Strict local variables. Only use variables set in locals in templates.
false
fragment_cache
Caches the contents in a fragment. cache เนื้อหาอยู่ใน fragment มันจะบันทึกเนื้อหาอยู่ใน fragment และ cache นั้นจะทำให้ request ท่ีเกี่ยวข้องนั้นมีการตอบรับเร็วขึ้น
Inserts formatted date and time. date can be unix time, ISO string, date object, or Moment.js object. date นั้นเป็น unix time, ISO string, date object, หรือ Moment.js object ได้ format นั้นถูกตั้งค่าเป็น date_format + time_format อยู่แล้ว by default
<%- full_date(date, [format]) %>
Examples:
<%- full_date(newDate()) %> // Jan 1, 2013 0:00:00
<%- full_date(newDate(), 'dddd, MMMM Do YYYY, h:mm:ss a') %> // Tuesday, January 1st 2013, 12:00:00 am
relative_date
Inserts relative time from now. date can be unix time, ISO string, date object, or Moment.js object.
<%- relative_date(date) %>
Examples:
<%- relative_date(newDate()) %> // a few seconds ago
<%- relative_date(newDate(1000000000000)) %> // 22 years ago
time_tag
Inserts time tag. date นั้นจะเป็น unix time, ISO string, date object, หรือ Moment.js object ได้ date นั้นเป็น unix time, ISO string, date object, หรือ Moment.js object ได้ format นั้นถูกตั้งค่าเป็น time_format อยู่แล้ว by default
Sort of order. 1, asc for ascending; -1, desc for descending
1
show_count
Display the number of posts for each category
true
style
Style to display the category list. list displays categories in an unordered list. Use false or any other value to disable it.
list
separator
Separator between categories. (Only works if style is not list)
,
depth
Levels of categories to be displayed. 0 displays all categories and child categories; -1 is similar to 0 but displayed in flat; 1 displays only top level categories.
0
class
Class name of tag list.
category
transform
The function that changes the display of category name.
Sort of order. 1, asc for ascending; -1, desc for descending
1
show_count
Display the number of posts for each archive
true
format
Date format
MMMM YYYY
style
Style to display the archive list. list displays archives in an unordered list. Use false or any other value to disable it.
list
separator
Separator between archives. (Only works if style is not list)
,
class
Class name of archive list.
archive
transform
The function that changes the display of archive name. See examples in list_categories.
list_posts
เสียบรายชื่อโพสต์เข้า:
<%- list_posts([options]) %>
Option
Description
Default
orderby
Order of posts
date
order
Sort of order. 1, asc for ascending; -1, desc for descending
1
style
Style to display the post list. list displays posts in an unordered list. Use false or any other value to disable it.
list
separator
Separator between posts. (Only works if style is not list)
,
class
Class name of post list.
post
amount
The number of posts to display (0 = unlimited)
6
transform
The function that changes the display of post name. See examples in list_categories.
tagcloud
เสียบ tag cloud เข้า:
<%- tagcloud([tags], [options]) %>
Option
Description
Default
min_font
Minimal font size
10
max_font
Maximum font size
20
unit
Unit of font size
px
amount
Total amount of tags
unlimited
orderby
Order of tags
name
order
Sort order. 1, sac as ascending; -1, desc as descending
1
color
Colorizes the tag cloud
false
start_color
Start color. You can use hex (#b700ff), rgba (rgba(183, 0, 255, 1)), hsla (hsla(283, 100%, 50%, 1)) or color keywords. This option only works when color is true.
end_color
End color. You can use hex (#b700ff), rgba (rgba(183, 0, 255, 1)), hsla (hsla(283, 100%, 50%, 1)) or color keywords. This option only works when color is true.
class
Class name prefix of tags
level
The number of different class names. This option only works when class is set.
10
show_count (+6.3.0)
Display the number of posts for each tag
false
count_class (+6.3.0)
The function that changes the display of tag name.
count
Examples:
// Default options <%- tagcloud() %>
// Limit number of tags to 30 <%- tagcloud({amount: 30}) %>
Miscellaneous
paginator
เสียบ paginator เข้า:
<%- paginator(options) %>
Option
Description
Default
base
Base URL
/
format
URL format
page/%d/
total
The number of pages
1
current
Current page number
0
prev_text
The link text of previous page. Works only if prev_next is set to true.
Prev
next_text
The link text of next page. Works only if prev_next is set to true.
Next
space
The space text
&hellp;
prev_next
Display previous and next links
true
end_size
The number of pages displayed on the start and the end side
1
mid_size
The number of pages displayed between current page, but not including current page
2
show_all
Display all pages. If this is set true, end_size and mid_size will not works.