package handlers

import (
	"html/template"
	"net/http"
)

var (
	templateBlog = template.Must(template.ParseFiles(
		"html/blog.html",
		"html/directory.html",
	))
	templateArticle = template.Must(template.ParseFiles(
		"html/blog.html",
		"html/article.html",
	))
)

func BlogHandler(w http.ResponseWriter, r *http.Request) {
	if err := templateBlog.Execute(w, nil); err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}

func BlogArticleHandler(w http.ResponseWriter, r *http.Request) {
	if err := templateArticle.Execute(w, nil); err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}
