first commit

This commit is contained in:
patarapolw committed 2019-08-12 01:13:27 +07:00
commit 379b9d1a62
24 files changed
+3828

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
# Cogear.JS theme **blog**
![screenshot](https://github.com/codemotion/cogear-theme-blog/raw/master/screenshot.jpg)
Theme with blog posts on the home page.
Simple responsive design. Posts tags support with navigation and pagination.
# Installation
You need to install [`cogear-plugin-blog`](https://github.com/codemotion/cogear-plugin-blog) to use this theme.
Go to the site folder and install theme with command:
```bash
yarn add cogear-theme-blog
# or
npm install cogear-theme-blog
```
After that you need to edit your site `config.yaml` to set up installed theme.
```yaml
theme: blog
```
# Configuration
Use `cogear-plugin-blog` options in `./config.yaml`:
``` yaml
title: Blog | Cogear.JS – modern static websites generator
description:
keywords:
theme: blog
blog:
index: "" # Provide posts to index page
regex: "^p/"
tagUri: 'tag'
perPage: 5
pages:
^p/:
layout: post
author:
login: User
avatar: 'https://www.gravatar.com/avatar/400caf343d3bab57ab93f63e21a12be7?s=24'
link: https://cogearjs.org
```
# Usage
You may also want to install in with [`cogear-preset-blog`](https://github.com/codemotion/cogear-preset-blog).
# Docs
More info: [https://cogearjs.org/docs/themes](https://cogearjs.org/docs/themes).
+13
View File
@@ -0,0 +1,13 @@
article.post
header: h1 Write a post!
.post-content
p Go to <code>./src/pages/p</code> folder and create your first post, creating <code>first-post.md</code> file filled with the following content:
pre.
---
title: First post
tags:
- news
---
# This is my first post!
p Any questions? More info: <a href="https://github.com/codemotion/cogear-template-blog">https://github.com/codemotion/cogear-template-blog</a>
a(href="https://cogearjs.org"): img(src="https://cogearjs.org/images/cogearjs.jpg")
+13
View File
@@ -0,0 +1,13 @@
head
title=title
link(rel="shortcut icon" href=`${cogear.config.baseUrl || "/"}favicon.ico` type="image/png")
body
.navbar
.container
.brand
a(href="/") Blog
if cogear.blog.tags
ul
each t in cogear.blog.tags
- tName = t[0].toUpperCase() + t.slice(1)
li: a(href=`/tags/${t}`)= tName
+21
View File
@@ -0,0 +1,21 @@
mixin post(post)
.card.p-2.post(class=`${post.teaser ? 'teaser' : 'full'}`)
.post-meta.mb-3
.float-right
+date(post.date)
.post-meta--author
a(href=`${post.author.link}`): img.mr-3(src=`${post.author.avatar}`)
a(href=`${post.author.link}`)= post.author.login
header
if post.teaser
h2: a(href=`/${post.uri}`)= post.title
else
h1= post.title
.post-content!= post.teaser ? post.teaser : post.content
if !post.teaser
a(href="javascript: history.back()") &larr; Back
mixin date(date)
- let months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
- let d = new Date(date)
- month = months[d.getMonth()]
time= `${month} ${d.getDate()}`
+21
View File
@@ -0,0 +1,21 @@
extends layout.pug
block head
if tag
- tagName = tag[0].toUpperCase() + tag.slice(1)
- title= `${tagName} | ${title}`
if paginator && paginator.current > 1
- title = `Page ${paginator.current} | ${title}`
title= title
block content
if tag
h1.tag= tagName
if content
article.page!= content
else if posts
- let now = new Date()
each post in posts
if new Date(post.date) < now
+post(post)
include paginator
else
include includes/empty
+20
View File
@@ -0,0 +1,20 @@
include includes/mixins
head
block head
title= title
meta(content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1.0, maximum-scale=1" name="viewport")
link(rel="shortcut icon" href=`${cogear.config.baseUrl || "/"}favicon.png` type="image/png")
link(rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous')
body
nav.navbar.navbar-dark.bg-success
a.ml-3.navbar-brand(href=cogear.config.baseUrl || "/")= cogear.config.blog.title || "BLOG"
.container.mt-3
.row
.col-lg-8.col-md-12
block content
.col-lg-4.col-md-12
include sidebar
script(src='https://code.jquery.com/jquery-3.3.1.slim.min.js' integrity='sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo' crossorigin='anonymous')
script(src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js' integrity='sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1' crossorigin='anonymous')
script(src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM' crossorigin='anonymous')
+23
View File
@@ -0,0 +1,23 @@
if paginator
nav.mt-3
ul.pagination
if paginator.prev !== null
li.page-item
a.page-link(href=`${cogear.config.baseUrl || "/"}${paginator.prev}`) &larr; Prev
- let page = 1
while page <= paginator.total
- let range = 2
if page == 1 || page == paginator.total || (page >= paginator.current - range && page <= paginator.current + range)
if page == paginator.current
li.page-item.active
a.page-link(href=`${paginator.baseUri}/${page}`)= page
else
li.page-item
a.page-link(href=`${paginator.baseUri}/${page}`)= page
else if paginator.current < paginator.total - range && page == paginator.total - 1 || paginator.current > 1+range && page == range
li.page-item
a.page-link.ellipsis …
- page=page+1
if paginator.next !== null
li.page-item
a.page-link(href=`/${paginator.next}`) Next &rarr;
+12
View File
@@ -0,0 +1,12 @@
extends layout.pug
block content
+post({
title:title,
teaser: false,
tags:tags,
content:content,
date:date,
author: author
})
#disqus_thread
+7
View File
@@ -0,0 +1,7 @@
aside.card.p-3
block sidebar
:markdown-it
#### Record my journey to Chinese by [@polvcode](https://polvcode.dev)
a.twitter-timeline(href="https://twitter.com/ChinesePol" data-height="600") Tweets by ChinesePol
script(async src="https://platform.twitter.com/widgets.js" charset="utf-8")
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

+1
View File
@@ -0,0 +1 @@
import "./theme.scss";
+7
View File
@@ -0,0 +1,7 @@
.post {
.post-meta {
img {
border-radius: 50%;
}
}
}