-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (37 loc) · 1.17 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Workaround for issues in Netlify which started to occur
# recently
POETRY := poetry --no-plugins
THEME_REPO := https://github.com/jvanz/pelican-hyde.git
theme:
(ls theme/ > /dev/null && cd theme/ && git pull) || git clone $(THEME_REPO) theme/
dev:
$(POETRY) run pelican --listen --autoreload
publish:
$(POETRY) run pelican
venv:
$(POETRY) env use $(shell which python3)
$(POETRY) install
deploy: venv theme publish
# https://github.com/getpelican/pelican/wiki/Tips-n-Tricks#make-newpost
PAGESDIR=content/articles
DATE := $(shell date +'%Y-%m-%d %H:%M:%S')
SLUG := $(shell echo '${NAME}' | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z)
EXT := md
newpost:
ifdef NAME
@echo "Title: $(NAME)" > $(PAGESDIR)/$(SLUG).$(EXT)
@echo "Slug: $(SLUG)" >> $(PAGESDIR)/$(SLUG).$(EXT)
@echo "Date: $(DATE)" >> $(PAGESDIR)/$(SLUG).$(EXT)
@echo "Description:" >> $(PAGESDIR)/$(SLUG).$(EXT)
@echo "" >> $(PAGESDIR)/$(SLUG).$(EXT)
@echo "" >> $(PAGESDIR)/$(SLUG).$(EXT)
@echo File available at ${PAGESDIR}/${SLUG}.${EXT}
else
@echo 'Variable NAME is not defined.'
@echo 'Do make newpost NAME='"'"'Post Name'"'"
endif
.PHONY: theme \
dev \
publish \
deploy \
newpost