Add (not currently working) settings to generate a SQL db
This commit is contained in:
parent
fef9c0895e
commit
2422df5db7
11
config.toml
11
config.toml
@ -4,6 +4,17 @@ theme = "terminal"
|
|||||||
paginate = 5
|
paginate = 5
|
||||||
enableGitInfo = true
|
enableGitInfo = true
|
||||||
|
|
||||||
|
[mediaTypes]
|
||||||
|
[mediaTypes."text/sql"]
|
||||||
|
suffixes = ["sql"]
|
||||||
|
|
||||||
|
[outputFormats]
|
||||||
|
[outputFormats.SQL]
|
||||||
|
mediaType = "text/sql"
|
||||||
|
|
||||||
|
[outputs]
|
||||||
|
home = ["sql", "html"]
|
||||||
|
|
||||||
# [permalinks]
|
# [permalinks]
|
||||||
# posts = "/:year/:month/:title/"
|
# posts = "/:year/:month/:title/"
|
||||||
|
|
||||||
|
17
layouts/_default/baseof.sql.sql
Normal file
17
layouts/_default/baseof.sql.sql
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
DROP TABLE IF EXISTS db.blog;
|
||||||
|
|
||||||
|
CREATE TABLE db.blog (
|
||||||
|
id INT NOT NULL AUTO_INCREMENT,
|
||||||
|
published DATE NOT NULL,
|
||||||
|
title TEXT NOT NULL,
|
||||||
|
body TEXT NOT NULL,
|
||||||
|
url varchar(2048) NOT NULL,
|
||||||
|
CONSTRAINT id_PK PRIMARY KEY (id)
|
||||||
|
)
|
||||||
|
ENGINE=InnoDB
|
||||||
|
DEFAULT CHARSET=utf8mb4
|
||||||
|
COLLATE=utf8mb4_general_ci;
|
||||||
|
CREATE FULLTEXT INDEX blog_body_IDX ON db.blog (body);
|
||||||
|
|
||||||
|
{{ block "main" .}}
|
||||||
|
{{ end }}
|
13
layouts/_default/home.sql.sql
Normal file
13
layouts/_default/home.sql.sql
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{{ define "main" }}
|
||||||
|
{{ range (where .Pages "Section" "ne" "gist") }}
|
||||||
|
{{ range .Pages }}
|
||||||
|
INSERT INTO db.blog (published, title, body, url)
|
||||||
|
VALUES(
|
||||||
|
'{{ .Date.Format "2006-01-02" }}',
|
||||||
|
'{{ plainify .Title }}',
|
||||||
|
'{{ (plainify .Content) }}',
|
||||||
|
'{{ .Permalink }}'
|
||||||
|
);
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
Reference in New Issue
Block a user