sc0ttj / mdsh

A simple static site generator, using Markdown and Bash
https://sc0ttj.github.io/mdsh/
10 stars 0 forks source link

Page types #1

Closed sc0ttj closed 5 years ago

sc0ttj commented 5 years ago

When creating a new post with new post -all, users should be asked to choose page type.

These should be based on the types available at schema.org

The default should be post if using new post, or page if using new page.

The list of valid options should be:

post (blogPosting)
page (webPage)
article
book
howTo
review
event
product (individualProduct)
softwareSourceCode 

Depending on the 'type' chosen, the user should be asked for extra info, and the page generated should contain the extra JSON-LD meta info.

The extra info could be something like:

Depending on the page type, extra content could be included on the page, for example:

To use it:

$ new post -all

and you will be asked to give extra info, such as:

Choose a page type (post,page,howTo,event,product,review): product
Enter a price: £12.99
...

the code to generate the template vars that are specific to the page type:

case "$page_type" in 
  post) ;;
  page) ;;
  product)
    # set any type specific vars
    item_price="${post_price}" 
    # if these custom vars need to appear inside a loop (in the templates):
    list="$(ls some/dir | whatever)"
    for item in $list
        # define any vars used in the templates ITEMS array
        item_price="${post_price}" 
        # add the vars to the ITEMS array
        eval $(add_hash_to_array)
    done
    # then generate any type specific HTML from the relvant templates 
    ld_product="$(render _product  json-ld)"
    ;;
 *)
esac
sc0ttj commented 5 years ago

outdated after data folder implemented, closing