From 57d66eb0c1ce8f11add3c4f3bcf77c7b84761701 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 24 Sep 2019 20:30:38 +0900 Subject: [PATCH] init staticcms Signed-off-by: Nico Schottelius --- assets/static/style.css | 42 +++++++++++++++++++++++++++++ content/about/contents.lr | 7 +++++ content/blog/contents.lr | 3 +++ content/blog/first-post/contents.lr | 9 +++++++ content/contents.lr | 6 +++++ content/projects/contents.lr | 9 +++++++ models/blog-post.ini | 29 ++++++++++++++++++++ models/blog.ini | 16 +++++++++++ models/page.ini | 11 ++++++++ templates/blog-post.html | 6 +++++ templates/blog.html | 11 ++++++++ templates/layout.html | 29 ++++++++++++++++++++ templates/macros/blog.html | 20 ++++++++++++++ templates/macros/pagination.html | 15 +++++++++++ templates/page.html | 6 +++++ ungleich static cms.lektorproject | 2 ++ 16 files changed, 221 insertions(+) create mode 100644 assets/static/style.css create mode 100644 content/about/contents.lr create mode 100644 content/blog/contents.lr create mode 100644 content/blog/first-post/contents.lr create mode 100644 content/contents.lr create mode 100644 content/projects/contents.lr create mode 100644 models/blog-post.ini create mode 100644 models/blog.ini create mode 100644 models/page.ini create mode 100644 templates/blog-post.html create mode 100644 templates/blog.html create mode 100644 templates/layout.html create mode 100644 templates/macros/blog.html create mode 100644 templates/macros/pagination.html create mode 100644 templates/page.html create mode 100644 ungleich static cms.lektorproject diff --git a/assets/static/style.css b/assets/static/style.css new file mode 100644 index 0000000..7ff6e0b --- /dev/null +++ b/assets/static/style.css @@ -0,0 +1,42 @@ +body { + font-family: 'Verdana', sans-serif; + margin: 50px 25px; +} + +a { + color: #2a99b6; +} + +a:hover { + color: #33bbdf; +} + +header, footer, div.page { + width: 760px; + margin: 0 auto; + background: #daeef3; + padding: 20px 30px; +} + +header h1 { + color: #169bbd; + margin: 0; + font-weight: normal; + font-size: 42px; +} + +header nav ul { + list-style: none; + margin: 0; + padding: 0; +} + +header nav ul li { + display: inline; + margin: 0 8px 0 0; + padding: 0; +} + +div.page { + background: #f1fbfe; +} diff --git a/content/about/contents.lr b/content/about/contents.lr new file mode 100644 index 0000000..9edb4d5 --- /dev/null +++ b/content/about/contents.lr @@ -0,0 +1,7 @@ +title: About this Website +--- +body: + +This is a website that was made with the Lektor quickstart. + +And it does not contain a lot of information. diff --git a/content/blog/contents.lr b/content/blog/contents.lr new file mode 100644 index 0000000..56be89d --- /dev/null +++ b/content/blog/contents.lr @@ -0,0 +1,3 @@ +_model: blog +--- +title: Blog diff --git a/content/blog/first-post/contents.lr b/content/blog/first-post/contents.lr new file mode 100644 index 0000000..73b6eef --- /dev/null +++ b/content/blog/first-post/contents.lr @@ -0,0 +1,9 @@ +title: Hello Website +--- +pub_date: 2019-09-24 +--- +author: ungleich +--- +body: + +This is an example blog post. Not much here but that's not the point :) diff --git a/content/contents.lr b/content/contents.lr new file mode 100644 index 0000000..445a1b7 --- /dev/null +++ b/content/contents.lr @@ -0,0 +1,6 @@ +title: Welcome to ungleich static cms! +--- +body: + +This is a basic demo website that shows how to use Lektor for a basic +website with some pages and a blog. diff --git a/content/projects/contents.lr b/content/projects/contents.lr new file mode 100644 index 0000000..f3658c6 --- /dev/null +++ b/content/projects/contents.lr @@ -0,0 +1,9 @@ +title: Projects +--- +body: + +This is a list of the projects: + +* Project 1 +* Project 2 +* Project 3 diff --git a/models/blog-post.ini b/models/blog-post.ini new file mode 100644 index 0000000..edccc34 --- /dev/null +++ b/models/blog-post.ini @@ -0,0 +1,29 @@ +[model] +name = Blog Post +label = {{ this.title }} +hidden = yes + +[fields.title] +label = Title +type = string +size = large + +[fields.author] +label = Author +type = string +width = 1/2 + +[fields.twitter_handle] +label = Twitter Handle +type = string +width = 1/4 +addon_label = @ + +[fields.pub_date] +label = Publication date +type = date +width = 1/4 + +[fields.body] +label = Body +type = markdown diff --git a/models/blog.ini b/models/blog.ini new file mode 100644 index 0000000..0a3a3ca --- /dev/null +++ b/models/blog.ini @@ -0,0 +1,16 @@ +[model] +name = Blog +label = Blog +hidden = yes + +[fields.title] +label = Title +type = string + +[children] +model = blog-post +order_by = -pub_date, title + +[pagination] +enabled = yes +per_page = 10 diff --git a/models/page.ini b/models/page.ini new file mode 100644 index 0000000..dcddfe8 --- /dev/null +++ b/models/page.ini @@ -0,0 +1,11 @@ +[model] +name = Page +label = {{ this.title }} + +[fields.title] +label = Title +type = string + +[fields.body] +label = Body +type = markdown diff --git a/templates/blog-post.html b/templates/blog-post.html new file mode 100644 index 0000000..6f24d52 --- /dev/null +++ b/templates/blog-post.html @@ -0,0 +1,6 @@ +{% extends "layout.html" %} +{% from "macros/blog.html" import render_blog_post %} +{% block title %}{{ this.title }}{% endblock %} +{% block body %} + {{ render_blog_post(this) }} +{% endblock %} diff --git a/templates/blog.html b/templates/blog.html new file mode 100644 index 0000000..cb79934 --- /dev/null +++ b/templates/blog.html @@ -0,0 +1,11 @@ +{% extends "layout.html" %} +{% from "macros/blog.html" import render_blog_post %} +{% from "macros/pagination.html" import render_pagination %} +{% block title %}{{ this.title }}{% endblock %} +{% block body %} + {% for child in this.pagination.items %} + {{ render_blog_post(child, from_index=true) }} + {% endfor %} + + {{ render_pagination(this.pagination) }} +{% endblock %} diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..90bff12 --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,29 @@ + + + +{% block title %}Welcome{% endblock %} — ungleich static cms + +
+

ungleich static cms

+ +
+
+ {% block body %}{% endblock %} +
+
+ © Copyright 2019 by ungleich. +
+ diff --git a/templates/macros/blog.html b/templates/macros/blog.html new file mode 100644 index 0000000..d345b90 --- /dev/null +++ b/templates/macros/blog.html @@ -0,0 +1,20 @@ +{% macro render_blog_post(post, from_index=false) %} +
+ {% if from_index %} +

{{ post.title }}

+ {% else %} +

{{ post.title }}

+ {% endif %} +

+ written by + {% if post.twitter_handle %} + {{ post.author or post.twitter_handle }} + {% else %} + {{ post.author }} + {% endif %} + on {{ post.pub_date }} +

+ {{ post.body }} +
+{% endmacro %} diff --git a/templates/macros/pagination.html b/templates/macros/pagination.html new file mode 100644 index 0000000..077cc5a --- /dev/null +++ b/templates/macros/pagination.html @@ -0,0 +1,15 @@ +{% macro render_pagination(pagination) %} + +{% endmacro %} diff --git a/templates/page.html b/templates/page.html new file mode 100644 index 0000000..0430577 --- /dev/null +++ b/templates/page.html @@ -0,0 +1,6 @@ +{% extends "layout.html" %} +{% block title %}{{ this.title }}{% endblock %} +{% block body %} +

{{ this.title }}

+ {{ this.body }} +{% endblock %} diff --git a/ungleich static cms.lektorproject b/ungleich static cms.lektorproject new file mode 100644 index 0000000..d59deaf --- /dev/null +++ b/ungleich static cms.lektorproject @@ -0,0 +1,2 @@ +[project] +name = ungleich static cms