Browse Source

add admin pannel to make post creation easier (#48)

pull/50/head
Cian Butler 4 years ago
committed by GitHub
parent
commit
ee88883594
6 changed files with 62 additions and 5 deletions
  1. +1
    -0
      _config.yml
  2. +14
    -2
      layout/common/post/banner.ejs
  3. +14
    -2
      layout/common/thumbnail.ejs
  4. +1
    -1
      layout/index.ejs
  5. +20
    -0
      source/admin/config.yml
  6. +12
    -0
      source/admin/index.html

+ 1
- 0
_config.yml View File

@@ -1,3 +1,4 @@
---
# Customise
customize:
logo:


+ 14
- 2
layout/common/post/banner.ejs View File

@@ -1,11 +1,23 @@
<% if (post.link) { %>
<a href="<%- url_for(post.link) %>" target="_blank" itemprop="url">
<img src="<%- url_for(post.link) %><%- post.banner %>" class="article-banner" />
<img src="
<% if (post.banner.charAt(0) !== '/') { %>
<%- url_for(post.link) %><%- post.banner %>
<% } else { %>
<%= post.banner %>
<% } %>
" class="article-banner" />
</a>
<% } else if (post.title) { %>
<% if (index) { %>
<a href="<%- url_for(post.path) %>" itemprop="url">
<img src="<%- url_for(post.path) %><%- post.banner %>" class="article-banner" />
<img src="
<% if (post.banner.charAt(0) !== '/') { %>
<%- url_for(post.path) %><%- post.banner %>
<% } else { %>
<%= post.banner %>
<% } %>
" class="article-banner" />
</a>
<% } else { %>
<img src="<%- post.banner %>" class="article-banner" />


+ 14
- 2
layout/common/thumbnail.ejs View File

@@ -1,8 +1,20 @@
<div class="thumbnail">
<% if (post.thumbnail) { %>
<span style="background-image:url(<%- url_for(post.path) %><%= post.thumbnail %>)" alt="<%= post.title %>" class="thumbnail-image"></span>
<span style="background-image:url(
<% if (post.thumbnail.charAt(0) !== '/') { %>
<%- url_for(post.path) %><%= post.thumbnail %>
<% } else { %>
<%= post.thumbnail %>
<% } %>
)" alt="<%= post.title %>" class="thumbnail-image"></span>
<% } else if (post.banner) { %>
<span style="background-image:url(<%- url_for(post.path) %><%= post.banner %>)" alt="<%= post.title %>" class="thumbnail-image"></span>
<span style="background-image:url(
<% if (post.banner.charAt(0) !== '/') { %>
<%- url_for(post.path) %><%= post.banner %>
<% } else { %>
<%= post.banner %>
<% } %>
)" alt="<%= post.title %>" class="thumbnail-image"></span>
<% } else { %>
<span class="thumbnail-image thumbnail-none"></span>
<% } %>


+ 1
- 1
layout/index.ejs View File

@@ -8,4 +8,4 @@ if (page.total > 1) { %>
next_text: __('nav.next') + ' &raquo;'
}) %>
</nav>
<% } %>
<% } %>

+ 20
- 0
source/admin/config.yml View File

@@ -0,0 +1,20 @@
---
backend:
name: github
repo: redbrick/static-site
branch: master
publish_mode: editorial_workflow
media_folder: "source/assets/images/posts"
public_folder: "/assets/images/posts"
collections:
- name: "blog" # Used in routes, e.g. /admin/collections/blog
label: "Blog" # Used in the UI
folder: "source/_posts"
create: true
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
fields:
- {label: "Title", name: "title", widget: "string"}
- {label: "Publish Date", name: "date", widget: "datetime"}
- {label: "Featured Image", name: "banner", widget: "image"}
- {label: "Author", name: "author", widget: "string"}
- {label: "Body", name: "body", widget: "markdown"}

+ 12
- 0
source/admin/index.html View File

@@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Content Manager</title>
<link rel="stylesheet" href="https://unpkg.com/netlify-cms@^0.3/dist/cms.css" />
</head>
<body>
<script src="https://unpkg.com/netlify-cms@^0.3/dist/cms.js"></script>
</body>
</html>

Loading…
Cancel
Save