Add directory name to jinja context.
Fix bug getting relative thumbnail path when the build directory is outside app root.