Create a gist now

Instantly share code, notes, and snippets.

@tdhopper /README.md
Last active Dec 20, 2015

What would you like to do?
Details on how I build my Pelican website

My scripts for building stiglerdiet.com with Pelican and uploading to Amazon S3 bucket.

Requires:

json files should go into templates folder of ofexport. Modify the ofexport commands to fit your needs. In particular, _Nonurgent is the folder my projects are in, and "Posts to Write" and "To Read" are the projects I'm uploading.

This will create todo.sh in your Pelican pages folder as well, compile your site with Pelican, and then push to s3.

{
"#01": "markdown",
"#02": "A template for markdown files",
"attributes": {
"context": {
"default": "",
"eval": "value.name",
"format": " project:**$value**",
"type": "string"
},
"date_completed": {
"default": "",
"format": " done:**$value**",
"type": "date"
},
"date_due": {
"default": "",
"format": " due:**$value**",
"type": "date"
},
"date_to_start": {
"default": "",
"format": " start:**$value**",
"type": "date"
},
"flagged": {
"default": "",
"eval": "True if value else None",
"format": " flagged",
"type": "boolean"
},
"hashes": {
"default": "",
"format": "$value",
"type": "string"
},
"id": {
"default": "",
"format": " $value",
"type": "string"
},
"link": {
"default": "",
"format": "$value",
"type": "string"
},
"name": {
"default": "",
"format": "$value",
"type": "string"
},
"note": {
"default": "",
"format": "$value",
"type": "note"
},
"project": {
"default": "",
"eval": "value.name",
"format": " context:**$value**",
"type": "string"
},
"type": {
"default": "",
"format": " $value",
"type": "string"
}
},
"dateFormat": "%Y-%m-%d",
"depth": 0,
"indent": 0,
"indentString": " ",
"nodes": {
"ContextStart": "$hashes$name",
"FolderStart": "$hashes$name",
"ProjectStart": "### $name",
"TaskGroupStart": "$indent- $name",
"TaskStart": "$indent- $name"
},
"preamble" : "\n\n\n# Completed Tasks"
}
{
"#01": "markdown",
"#02": "A template for markdown files",
"attributes": {
"context": {
"default": "",
"eval": "value.name",
"format": " project:**$value**",
"type": "string"
},
"date_completed": {
"default": "",
"format": " done:**$value**",
"type": "date"
},
"date_due": {
"default": "",
"format": " due:**$value**",
"type": "date"
},
"date_to_start": {
"default": "",
"format": " start:**$value**",
"type": "date"
},
"flagged": {
"default": "",
"eval": "True if value else None",
"format": " flagged",
"type": "boolean"
},
"hashes": {
"default": "",
"format": "$value",
"type": "string"
},
"id": {
"default": "",
"format": " $value",
"type": "string"
},
"link": {
"default": "",
"format": "$value",
"type": "string"
},
"name": {
"default": "",
"format": "$value",
"type": "string"
},
"note": {
"default": "",
"format": "$value",
"type": "note"
},
"project": {
"default": "",
"eval": "value.name",
"format": " context:**$value**",
"type": "string"
},
"type": {
"default": "",
"format": " $value",
"type": "string"
}
},
"dateFormat": "%Y-%m-%d",
"depth": 0,
"indent": 0,
"indentString": " ",
"nodes": {
"ContextStart": "$hashes$name",
"FolderStart": "$hashes$name",
"ProjectStart": "### $name",
"TaskGroupStart": "$indent- $name$date_completed",
"TaskStart": "$indent- $name$date_completed"
},
"preamble" : "XXXX",
"preambleFile" : "todo_head.txt"
}
### upload_to_amazon.sh
## Build todo.md page with ofexport
## Compile website with pelican
## Upload to Amazon S3 bucket
## Dump TODO data from Omnifocus
PELICAN_ROOT=~/Dropbox/Blogs/stiger-diet-pelican-active
PELICAN_PAGES=/content/pages
# Completed tasks
ofexport -o $PELICAN_ROOT$PELICAN_PAGES/done.md \
-f "(name='\_Nonurgent')" -f flatten \
-p "((name='Posts to Write') or (name='To Read'))" \
-I -t "(done='to today')" \
-T markdown_done_tasks
# Pelican style file header (imported by markdown_no_note template)
echo -n $'Title: Todo \nSlug: todo \nDate: ' > todo_head.txt
echo $(date +%Y-%m-%d) >> todo_head.txt
echo $'Author: Tim\n\n This page of blog posts
I\'d like to write and things I\'d
like to read is automatically generated from my
[Omnifocus](http://www.omnigroup.com/products/omnifocus/)
task list using
[ofexport](https://github.com/psidnell/ofexport).\n\n' >> todo_head.txt
# Unfinished tasks
ofexport -o $PELICAN_ROOT$PELICAN_PAGES/todo.md \
-f "(name='\_Nonurgent')" -f flatten \
-p "((name='Posts to Write') or (name='To Read'))" \
-E -t "(done='to today')" \
-T markdown_future_tasks
# Create final Pelican page Markdown file
cd $PELICAN_ROOT$PELICAN_PAGES/
cat done.md >> todo.md # Concatenate files
rm done.md # Remove file
## Compile website and upload
cd $PELICAN_ROOT
# Generate site
pelican -o static content --settings pelicanconf.py # Generate site
# Push to Amazon s3
s3cmd sync --acl-public --delete-removed static/ s3://stiglerdiet.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment