From a7a9c52ae62a637c3d3f58ba4f0debcd28990895 Mon Sep 17 00:00:00 2001 From: Frank Taillandier Date: Wed, 24 Oct 2018 14:31:30 +0200 Subject: [PATCH 1/2] docs: Page variables as YAML data --- docs/_data/jekyll_variables.yml | 160 +++++++++++++++ docs/_docs/variables.md | 335 +++----------------------------- 2 files changed, 182 insertions(+), 313 deletions(-) create mode 100644 docs/_data/jekyll_variables.yml diff --git a/docs/_data/jekyll_variables.yml b/docs/_data/jekyll_variables.yml new file mode 100644 index 00000000..68f44c8b --- /dev/null +++ b/docs/_data/jekyll_variables.yml @@ -0,0 +1,160 @@ +global: + - name: site + description: >- + Site wide information + configuration settings from + _config.yml. See below for details. + - name: page + description: >- + Page specific information + the front + matter. Custom variables set via the front matter will be + available here. See below for details. + - name: layout + description: >- + Layout specific information + the front + matter. Custom variables set via front matter in + layouts will be available here. + - name: content + description: >- + In layout files, the rendered content of the Post or Page being wrapped. + Not defined in Post or Page files. + - name: paginator + description: >- + When the paginate configuration option is set, this + variable becomes available for use. See Pagination for details. + +site: + - name: site.time + description: >- + The current time (when you run the jekyll command). + - name: site.pages + description: >- + A list of all Pages. + - name: site.posts + description: >- + A reverse chronological list of all Posts. + - name: site.related_posts + description: >- + If the page being processed is a Post, this contains a list of up to ten + related Posts. By default, these are the ten most recent posts. + For high quality but slow to compute results, run the + jekyll command with the --lsi (latent semantic indexing) option. Also note GitHub Pages does not support the lsi option when generating sites. + - name: site.static_files + description: >- + A list of all static files (i.e. + files not processed by Jekyll's converters or the Liquid renderer). + Each file has five properties: path, modified_time, name, basename and extname. + - name: site.html_pages + description: >- + A subset of `site.pages` listing those which end in `.html`. + - name: site.html_files + description: >- + A subset of `site.static_files` listing those which end in `.html`. + - name: site.collections + description: >- + A list of all the collections (including posts). + - name: site.data + description: >- + A list containing the data loaded from the YAML files located in the _data directory. + - name: site.documents + description: >- + A list of all the documents in every collection. + - name: site.categories.CATEGORY + description: >- + The list of all Posts in category CATEGORY. + - name: site.tags.TAG + description: >- + The list of all Posts with tag TAG. + - name: site.url + description: >- + Contains the url of your site as it is configured in the _config.yml. + For example, if you have url: http://mysite.com + in your configuration file, then it will be accessible in Liquid as + site.url. For the development environment there is + an exception, + if you are running jekyll serve in a development environment + site.url will be set to the value of host, + port, and SSL-related options. This defaults to + url: http://localhost:4000. + - name: site.[CONFIGURATION_DATA] + description: >- + All the variables set via the command line and your + _config.yml are available through the site + variable. For example, if you have foo: bar + in your configuration file, then it will be accessible in Liquid as site.foo. + Jekyll does not parse changes to _config.yml in + watch mode, you must restart Jekyll to see changes to variables. + +page: + - name: page.content + description: >- + The content of the Page, rendered or un-rendered depending upon + what Liquid is being processed and what page is. + - name: page.title + description: >- + The title of the Page. + - name: page.excerpt + description: >- + The un-rendered excerpt of a document. + - name: page.url + description: >- + The URL of the Post without the domain, but + with a leading slash, e.g. + /2008/12/14/my-post.html + - name: page.date + description: >- + The Date assigned to the Post. This can be overridden in a Post’s front + matter by specifying a new date/time in the format + YYYY-MM-DD HH:MM:SS (assuming UTC), or + YYYY-MM-DD HH:MM:SS +/-TTTT (to specify a time zone using + an offset from UTC. e.g. 2008-12-14 10:30:00 +0900). + - name: page.id + description: >- + An identifier unique to a document in a Collection or a Post (useful in RSS feeds). e.g. + /2008/12/14/my-post + /my-collection/my-document + - name: page.categories + description: >- + The list of categories to which this post belongs. Categories are + derived from the directory structure above the _posts + directory. For example, a post at + /work/code/_posts/2008-12-24-closures.md would have this + field set to ['work', 'code']. These can also be specified + in the front matter. + - name: page.tags + description: >- + The list of tags to which this post belongs. These can be specified in + the front matter. + - name: page.path + description: >- + The path to the raw post or page. Example usage: Linking back to the + page or post’s source on GitHub. This can be overridden in the + front matter. + - name: page.next + description: >- + The next post relative to the position of the current post in + site.posts. Returns nil for the last entry. + - name: page.previous + description: >- + The previous post relative to the position of the current post in + site.posts. Returns nil for the first entry. + +paginator: + - name: paginator.per_page + description: Number of Posts per page. + - name: paginator.posts + description: Posts available for that page. + - name: paginator.total_posts + description: Total number of Posts. + - name: paginator.total_pages + description: Total number of pages. + - name: paginator.page + description: The number of the current page. + - name: paginator.previous_page + description: The number of the previous page. + - name: paginator.previous_page_path + description: The path to the previous page. + - name: paginator.next_page + description: The number of the next page. + - name: paginator.next_page_path + description: The path to the next page. diff --git a/docs/_docs/variables.md b/docs/_docs/variables.md index df05cba3..3ffcfb5d 100644 --- a/docs/_docs/variables.md +++ b/docs/_docs/variables.md @@ -19,54 +19,14 @@ The following is a reference of the available data. + {% for var in site.data.jekyll_variables.global %} -

site

-

- - Sitewide information + configuration settings from - _config.yml. See below for details. - -

- - -

page

-

- - Page specific information + the front - matter. Custom variables set via the front matter will be - available here. See below for details. - -

- - -

layout

-

- - Layout specific information + the front - matter. Custom variables set via front matter in - layouts will be available here. - -

- - -

content

-

- - In layout files, the rendered content of the Post or Page being wrapped. - Not defined in Post or Page files. - -

- - -

paginator

-

- - When the paginate configuration option is set, this - variable becomes available for use. See Pagination for details. - -

+

{{ var.name }}

+ +

{{- var.description -}}

+ + {% endfor %} @@ -82,136 +42,14 @@ The following is a reference of the available data. + {% for var in site.data.jekyll_variables.site %} -

site.time

-

- - The current time (when you run the jekyll command). - -

- - -

site.pages

-

- - A list of all Pages. - -

- - -

site.posts

-

- - A reverse chronological list of all Posts. - -

- - -

site.related_posts

-

- - If the page being processed is a Post, this contains a list of up to ten - related Posts. By default, these are the ten most recent posts. - For high quality but slow to compute results, run the - jekyll command with the --lsi (latent semantic indexing) option. Also note GitHub Pages does not support the lsi option when generating sites. - -

- - -

site.static_files

-

- - A list of all static files (i.e. - files not processed by Jekyll's converters or the Liquid renderer). - Each file has five properties: path, modified_time, name, basename and extname. - -

- - -

site.html_pages

-

- - A subset of `site.pages` listing those which end in `.html`. - -

- - -

site.html_files

-

- - A subset of `site.static_files` listing those which end in `.html`. - -

- - -

site.collections

-

- - A list of all the collections. - -

- - -

site.data

-

- - A list containing the data loaded from the YAML files located in the _data directory. - -

- - -

site.documents

-

- - A list of all the documents in every collection. - -

- - -

site.categories.CATEGORY

-

- - The list of all Posts in category CATEGORY. - -

- - -

site.tags.TAG

-

- - The list of all Posts with tag TAG. - -

- - -

site.url

-

- - Contains the url of your site as it is configured in the _config.yml. - For example, if you have url: http://mysite.com - in your configuration file, then it will be accessible in Liquid as - site.url. For the development environment there is - an exception, - if you are running jekyll serve in a development environment - site.url will be set to the value of host, - port, and SSL-related options. This defaults to - url: http://localhost:4000. - -

- - -

site.[CONFIGURATION_DATA]

-

- - All the variables set via the command line and your - _config.yml are available through the site - variable. For example, if you have foo: bar - in your configuration file, then it will be accessible in Liquid as site.foo. - Jekyll does not parse changes to _config.yml in - watch mode, you must restart Jekyll to see changes to variables. - -

+

{{ var.name }}

+ +

{{- var.description -}}

+ + {% endfor %} @@ -227,113 +65,14 @@ The following is a reference of the available data. + {% for var in site.data.jekyll_variables.page %} -

page.content

-

- - The content of the Page, rendered or un-rendered depending upon - what Liquid is being processed and what page is. - -

- - -

page.title

-

- - The title of the Page. - -

- - -

page.excerpt

-

- - The un-rendered excerpt of a document. - -

- - -

page.url

-

- - The URL of the Post without the domain, but - with a leading slash, e.g. - /2008/12/14/my-post.html - -

- - -

page.date

-

- - The Date assigned to the Post. This can be overridden in a Post’s front - matter by specifying a new date/time in the format - YYYY-MM-DD HH:MM:SS (assuming UTC), or - YYYY-MM-DD HH:MM:SS +/-TTTT (to specify a time zone using - an offset from UTC. e.g. 2008-12-14 10:30:00 +0900). - -

- - -

page.id

-

- - An identifier unique to a document in a Collection or a Post (useful in RSS feeds). e.g. - /2008/12/14/my-post - /my-collection/my-document - -

- - -

page.categories

-

- - The list of categories to which this post belongs. Categories are - derived from the directory structure above the _posts - directory. For example, a post at - /work/code/_posts/2008-12-24-closures.md would have this - field set to ['work', 'code']. These can also be specified - in the front matter. - -

- - -

page.tags

-

- - The list of tags to which this post belongs. These can be specified in - the front matter. - -

- - -

page.path

-

- - The path to the raw post or page. Example usage: Linking back to the - page or post’s source on GitHub. This can be overridden in the - front matter. - -

- - -

page.next

-

- - The next post relative to the position of the current post in - site.posts. Returns nil for the last entry. - -

- - -

page.previous

-

- - The previous post relative to the position of the current post in - site.posts. Returns nil for the first entry. - -

+

{{ var.name }}

+ +

{{- var.description -}}

+ + {% endfor %} @@ -369,42 +108,12 @@ The following is a reference of the available data. + {% for var in site.data.jekyll_variables.paginator %} -

paginator.per_page

-

Number of Posts per page.

- - -

paginator.posts

-

Posts available for that page.

- - -

paginator.total_posts

-

Total number of Posts.

- - -

paginator.total_pages

-

Total number of pages.

- - -

paginator.page

-

The number of the current page.

- - -

paginator.previous_page

-

The number of the previous page.

- - -

paginator.previous_page_path

-

The path to the previous page.

- - -

paginator.next_page

-

The number of the next page.

- - -

paginator.next_page_path

-

The path to the next page.

+

{{ var.name }}

+

{{- var.description -}}

+ {% endfor %} From 75f1bccaa47df7225e1e3b808b7a4c9f0be80bd4 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Wed, 24 Oct 2018 19:21:30 +0530 Subject: [PATCH 2/2] Adjust whitespace --- docs/_data/jekyll_variables.yml | 101 +++++++++++++++----------------- docs/_docs/variables.md | 30 +++------- 2 files changed, 55 insertions(+), 76 deletions(-) diff --git a/docs/_data/jekyll_variables.yml b/docs/_data/jekyll_variables.yml index 68f44c8b..23e55a5e 100644 --- a/docs/_data/jekyll_variables.yml +++ b/docs/_data/jekyll_variables.yml @@ -1,27 +1,24 @@ global: - name: site description: >- - Site wide information + configuration settings from - _config.yml. See below for details. + Site wide information + configuration settings from _config.yml. + See below for details. - name: page description: >- - Page specific information + the front - matter. Custom variables set via the front matter will be - available here. See below for details. + Page specific information + the front matter. + Custom variables set via the front matter will be available here. See below for details. - name: layout description: >- - Layout specific information + the front - matter. Custom variables set via front matter in - layouts will be available here. + Layout specific information + the front matter. + Custom variables set via front matter in layouts will be available here. - name: content description: >- In layout files, the rendered content of the Post or Page being wrapped. Not defined in Post or Page files. - name: paginator description: >- - When the paginate configuration option is set, this - variable becomes available for use. See Pagination for details. + When the paginate configuration option is set, this variable becomes available + for use. See Pagination for details. site: - name: site.time @@ -35,15 +32,18 @@ site: A reverse chronological list of all Posts. - name: site.related_posts description: >- - If the page being processed is a Post, this contains a list of up to ten - related Posts. By default, these are the ten most recent posts. - For high quality but slow to compute results, run the - jekyll command with the --lsi (latent semantic indexing) option. Also note GitHub Pages does not support the lsi option when generating sites. + If the page being processed is a Post, this contains a list of up to ten related Posts. + By default, these are the ten most recent posts. For high quality but slow to compute + results, run the jekyll command with the --lsi + (latent semantic indexing) + option. Also note GitHub Pages does not support the + lsi option when generating sites. - name: site.static_files description: >- A list of all static files (i.e. files not processed by Jekyll's converters or the Liquid renderer). - Each file has five properties: path, modified_time, name, basename and extname. + Each file has five properties: path, modified_time, + name, basename and extname. - name: site.html_pages description: >- A subset of `site.pages` listing those which end in `.html`. @@ -55,7 +55,8 @@ site: A list of all the collections (including posts). - name: site.data description: >- - A list containing the data loaded from the YAML files located in the _data directory. + A list containing the data loaded from the YAML files located in the _data + directory. - name: site.documents description: >- A list of all the documents in every collection. @@ -68,20 +69,17 @@ site: - name: site.url description: >- Contains the url of your site as it is configured in the _config.yml. - For example, if you have url: http://mysite.com - in your configuration file, then it will be accessible in Liquid as - site.url. For the development environment there is - an exception, - if you are running jekyll serve in a development environment - site.url will be set to the value of host, - port, and SSL-related options. This defaults to - url: http://localhost:4000. - - name: site.[CONFIGURATION_DATA] + For example, if you have url: http://mysite.com in your configuration file, + then it will be accessible in Liquid as site.url. For the development + environment there is an + exception, if you are running jekyll serve in a development environment + site.url will be set to the value of host, port, + and SSL-related options. This defaults to url: http://localhost:4000. + - name: "site.[CONFIGURATION_DATA]" description: >- - All the variables set via the command line and your - _config.yml are available through the site - variable. For example, if you have foo: bar - in your configuration file, then it will be accessible in Liquid as site.foo. + All the variables set via the command line and your _config.yml are available + through the site variable. For example, if you have foo: bar in + your configuration file, then it will be accessible in Liquid as site.foo. Jekyll does not parse changes to _config.yml in watch mode, you must restart Jekyll to see changes to variables. @@ -98,46 +96,41 @@ page: The un-rendered excerpt of a document. - name: page.url description: >- - The URL of the Post without the domain, but - with a leading slash, e.g. + The URL of the Post without the domain, but with a leading slash, e.g. /2008/12/14/my-post.html - name: page.date description: >- - The Date assigned to the Post. This can be overridden in a Post’s front - matter by specifying a new date/time in the format - YYYY-MM-DD HH:MM:SS (assuming UTC), or - YYYY-MM-DD HH:MM:SS +/-TTTT (to specify a time zone using - an offset from UTC. e.g. 2008-12-14 10:30:00 +0900). + The Date assigned to the Post. This can be overridden in a Post’s front matter by specifying + a new date/time in the format YYYY-MM-DD HH:MM:SS (assuming UTC), or + YYYY-MM-DD HH:MM:SS +/-TTTT (to specify a time zone using an offset from UTC. + e.g. 2008-12-14 10:30:00 +0900). - name: page.id description: >- An identifier unique to a document in a Collection or a Post (useful in RSS feeds). e.g. - /2008/12/14/my-post - /my-collection/my-document + /2008/12/14/my-post/my-collection/my-document - name: page.categories description: >- - The list of categories to which this post belongs. Categories are - derived from the directory structure above the _posts - directory. For example, a post at - /work/code/_posts/2008-12-24-closures.md would have this - field set to ['work', 'code']. These can also be specified - in the front matter. + The list of categories to which this post belongs. Categories are derived from the directory + structure above the _posts directory. For example, a post at + /work/code/_posts/2008-12-24-closures.md would have this field set to + ['work', 'code']. These can also be specified in the + front matter. - name: page.tags description: >- - The list of tags to which this post belongs. These can be specified in - the front matter. + The list of tags to which this post belongs. These can be specified in the + front matter. - name: page.path description: >- - The path to the raw post or page. Example usage: Linking back to the - page or post’s source on GitHub. This can be overridden in the - front matter. + The path to the raw post or page. Example usage: Linking back to the page or post’s source + on GitHub. This can be overridden in the front matter. - name: page.next description: >- - The next post relative to the position of the current post in - site.posts. Returns nil for the last entry. + The next post relative to the position of the current post in site.posts. + Returns nil for the last entry. - name: page.previous description: >- - The previous post relative to the position of the current post in - site.posts. Returns nil for the first entry. + The previous post relative to the position of the current post in site.posts. + Returns nil for the first entry. paginator: - name: paginator.per_page diff --git a/docs/_docs/variables.md b/docs/_docs/variables.md index 3ffcfb5d..aabec18d 100644 --- a/docs/_docs/variables.md +++ b/docs/_docs/variables.md @@ -22,9 +22,7 @@ The following is a reference of the available data. {% for var in site.data.jekyll_variables.global %}

{{ var.name }}

- -

{{- var.description -}}

- +

{{- var.description -}}

{% endfor %} @@ -45,9 +43,7 @@ The following is a reference of the available data. {% for var in site.data.jekyll_variables.site %}

{{ var.name }}

- -

{{- var.description -}}

- +

{{- var.description -}}

{% endfor %} @@ -68,9 +64,7 @@ The following is a reference of the available data. {% for var in site.data.jekyll_variables.page %}

{{ var.name }}

- -

{{- var.description -}}

- +

{{- var.description -}}

{% endfor %} @@ -80,20 +74,14 @@ The following is a reference of the available data.
ProTip™: Use Custom Front Matter

- Any custom front matter that you specify will be available under page. For example, if you specify custom_css: true - in a page’s front matter, that value will be available as - page.custom_css. - + in a page’s front matter, that value will be available as page.custom_css.

- If you specify front matter in a layout, access that via layout. - For example, if you specify class: full_page - in a layout’s front matter, that value will be available as - layout.class in the layout and its parents. - + For example, if you specify class: full_page in a layout’s front matter, + that value will be available as layout.class in the layout and its parents.

@@ -121,9 +109,7 @@ The following is a reference of the available data.
Paginator variable availability

- - These are only available in index files, however they can be located in a - subdirectory, such as /blog/index.html. - + These are only available in index files, however they can be located in a subdirectory, + such as /blog/index.html.