avillafiorita / jekyll-datapage_gen

Generate one page per yaml record in Jekyll sites.
369 stars 80 forks source link

Support a `title` and `title_expr` to set the page title #72

Closed marceloverdijk closed 4 years ago

marceloverdijk commented 4 years ago

Similar as name and name_expr it would be nice to set the page title based on a property or expression derived from the record.

E.g.:

# - `title` is the key in `data` which determines the page title
# - `title_expr` is an expression for generating the page title

Currently the page title is set with self.data['title'] = raw_filename which in my case is not a nice title...

sahilk commented 4 years ago

name_expr seems to be taking precedence for me. Doesn't matter if I use title or title_expr, name_expr is what's being returned for {{ page.title }}.

This is what's in my config.yml:

page_gen:
- data: acts.records
  template: page-act
  dir: acts
  name_expr: record['fields']['act_name'] + "-" + record['id']
  title_expr: record['fields']['act_name']