endif
# The following can be configured in config
-BLOG_DATE_FORMAT_INDEX ?= %x
-BLOG_DATE_FORMAT ?= %x %X
+BLOG_DATE_FORMAT_INDEX ?= %d/%m/%Y
+BLOG_DATE_FORMAT ?= %d/%m/%Y %X
BLOG_TITLE ?= blog
BLOG_DESCRIPTION ?= blog
+BLOG_AUTHOR ?= John Doe
BLOG_URL_ROOT ?= http://localhost/blog
BLOG_FEED_MAX ?= 20
BLOG_FEEDS ?= rss atom
mkdir -p blog
TITLE="$(BLOG_TITLE)"; \
export TITLE; \
+ DESCRIPTION="$(BLOG_DESCRIPTION)"; \
+ export DESCRIPTION; \
+ AUTHOR="$(BLOG_AUTHOR)"; \
+ export AUTHOR; \
envsubst < templates/header.html > $@; \
envsubst < templates/index_header.html >> $@; \
envsubst < templates/tag_list_header.html >> $@; \
blog/@%.html: $(TAGFILES) $(addprefix templates/,$(addsuffix .html,header tag_index_header tag_list_header tag_entry tag_separator tag_list_footer article_list_header article_entry article_separator article_list_footer tag_index_footer footer))
mkdir -p blog
- TITLE="Articles tagged $*"; \
+ TITLE="$(BLOG_TITLE) - Articles tagged $*"; \
TAGS="$*"; \
+ AUTHOR=""; \
+ export AUTHOR; \
export TITLE; \
export TAGS; \
envsubst < templates/header.html > $@; \
blog/%.html: $(BLOG_SRC)/%.md $(addprefix templates/,$(addsuffix .html,header article_header article_footer footer))
mkdir -p blog
- TITLE="$(shell head -n1 $<)"; \
+ TITLE=" $(BLOG_TITLE) - $(shell head -n1 $<)"; \
export TITLE; \
- AUTHOR="$(shell git log -n 1 --reverse --format="%cn" -- "$<")"; \
+ AUTHOR="$(shell git log -n 1 --reverse --format="%an" -- "$<")"; \
export AUTHOR; \
DATE_POSTED="$(shell git log --diff-filter=A --date="format:$(BLOG_DATE_FORMAT)" --pretty=format:'%ad' -- "$<")"; \
export DATE_POSTED; \
export DATE_EDITED; \
TAGS="$(shell grep -i '^; *tags:' "$<" | cut -d: -f2- | paste -sd ',')"; \
export TAGS; \
+ DESCRIPTION="$(shell grep -i '^; *description:' "$<" | cut -d: -f2-)"; \
+ export DESCRIPTION; \
+ OG_IMAGE="$(shell grep -i '^; *og_image:' "$<" | cut -d: -f2-)"; \
+ export OG_IMAGE; \
envsubst < templates/header.html > $@; \
envsubst < templates/article_header.html >> $@; \
sed -e 1d \
git log --diff-filter=A --date="format:%s %a, %d %b %Y %H:%M:%S %z" --pretty=format:'%ad%n' -- "$$f"; \
done | sort -k2nr | head -n $(BLOG_FEED_MAX) | cut -d" " -f1,3- | while IFS=" " read -r FILE DATE; do \
printf '<item>\n<title>%s</title>\n<link>%s</link>\n<guid>%s</guid>\n<pubDate>%s</pubDate>\n<description>%s</description>\n</item>\n' \
- "`head -n 1 $$FILE`" \
+ "`head -n 1 $$FILE | sed 's/&/&/'`" \
"$(BLOG_URL_ROOT)/`basename $$FILE .md`.html" \
"$(BLOG_URL_ROOT)/`basename $$FILE .md`.html" \
"$$DATE" \
- "`sed -n '1d;/^$$/{2{d;b};q};p' < $$FILE`"; \
+ "`cat "$$FILE" | grep ";description:" | cut -d: -f2-`"; \
done >> $@
printf '</channel>\n</rss>\n' >> $@
git log --diff-filter=A --date="format:%s %Y-%m-%dT%H:%M:%SZ" --pretty=format:'%ad %aN%n' -- "$$f"; \
done | sort -k2nr | head -n $(BLOG_FEED_MAX) | cut -d" " -f1,3- | while IFS=" " read -r FILE DATE AUTHOR; do \
printf '<entry>\n<title type="text">%s</title>\n<link rel="alternate" type="text/html" href="%s"/>\n<id>%s</id>\n<published>%s</published>\n<updated>%s</updated>\n<author><name>%s</name></author>\n<summary type="text">%s</summary>\n</entry>\n' \
- "`head -n 1 $$FILE`" \
+ "`head -n 1 $$FILE | sed 's/&/&/'`" \
"$(BLOG_URL_ROOT)/`basename $$FILE .md`.html" \
"$(BLOG_URL_ROOT)/`basename $$FILE .md`.html" \
"$$DATE" \
"`git log -n 1 --date="format:%Y-%m-%dT%H:%M:%SZ" --pretty=format:'%ad' -- "$$FILE"`" \
"$$AUTHOR" \
- "`sed -n '1d;/^$$/{2{d;b};q};p' < $$FILE`"; \
+ "`cat "$$FILE" | grep ";description:" | cut -d: -f2-`"; \
done >> $@
printf '</feed>\n' >> $@