Add projects category page
This commit is contained in:
parent
efb9fde850
commit
a49e0873b3
4 changed files with 53 additions and 2 deletions
|
@ -36,7 +36,6 @@ SOCIAL = social.generate()
|
||||||
DEFAULT_PAGINATION = False
|
DEFAULT_PAGINATION = False
|
||||||
DELETE_OUTPUT_DIRECTORY = True
|
DELETE_OUTPUT_DIRECTORY = True
|
||||||
|
|
||||||
|
|
||||||
PAGE_PATHS = ["pages"]
|
PAGE_PATHS = ["pages"]
|
||||||
PAGE_SAVE_AS = "{slug}/index.html"
|
PAGE_SAVE_AS = "{slug}/index.html"
|
||||||
PAGE_URL = "{slug}"
|
PAGE_URL = "{slug}"
|
||||||
|
@ -68,6 +67,8 @@ ARCHIVES_URL = False
|
||||||
ARCHIVES_SAVE_AS = False
|
ARCHIVES_SAVE_AS = False
|
||||||
|
|
||||||
CATEGORY_SAVE_AS = "{slug}/index.html"
|
CATEGORY_SAVE_AS = "{slug}/index.html"
|
||||||
|
CATEGORY_URL = "{slug}/"
|
||||||
|
|
||||||
CATEGORIES_SAVE_AS = False
|
CATEGORIES_SAVE_AS = False
|
||||||
USE_FOLDER_AS_CATEGORY = True
|
USE_FOLDER_AS_CATEGORY = True
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@ SITEMAP = {
|
||||||
|
|
||||||
import filters
|
import filters
|
||||||
JINJA_FILTERS = {
|
JINJA_FILTERS = {
|
||||||
"datetime": filters.format_datetime
|
"datetime": filters.format_datetime,
|
||||||
|
"raw": filters.html_to_raw
|
||||||
}
|
}
|
||||||
# Extra context
|
# Extra context
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
import iso8601
|
import iso8601
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
def format_datetime(value):
|
def format_datetime(value):
|
||||||
return iso8601.parse_date(str(value)).strftime("%x %-H:%M")
|
return iso8601.parse_date(str(value)).strftime("%x %-H:%M")
|
||||||
|
|
||||||
|
|
||||||
|
def html_to_raw(html):
|
||||||
|
soup = BeautifulSoup(html, "html.parser")
|
||||||
|
for script in soup(["script", "style"]): # Remove script / style tags
|
||||||
|
script.extract()
|
||||||
|
return soup.get_text()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
beautifulsoup4==4.4.1
|
||||||
colorama==0.3.6
|
colorama==0.3.6
|
||||||
flake8==2.5.0
|
flake8==2.5.0
|
||||||
gitpython==2.0.3
|
gitpython==2.0.3
|
||||||
|
|
40
theme/templates/category.html
Normal file
40
theme/templates/category.html
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block htmltitle %}
|
||||||
|
All {{ category }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<section class="bg-primary">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8 col-lg-offset-2 text-center">
|
||||||
|
<h1 class="section-heading">About Me</h1>
|
||||||
|
<hr class="light">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="no-padding" id="projects">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row no-gutter">
|
||||||
|
{% for article in dates %}
|
||||||
|
<div class="col-lg-4 col-sm-6">
|
||||||
|
<a href="#" class="portfolio-box">
|
||||||
|
<div class="portfolio-box-caption">
|
||||||
|
<div class="portfolio-box-caption-content">
|
||||||
|
<div class="project-category">
|
||||||
|
{{ article.title }}
|
||||||
|
</div>
|
||||||
|
<div class="project-name">
|
||||||
|
{{ article.summary|raw }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
Reference in a new issue