]> Untitled Git - bitcoindevkit.org/commitdiff
Add support for publishing blog posts
authorAlekos Filini <alekos.filini@gmail.com>
Wed, 18 Nov 2020 16:21:28 +0000 (17:21 +0100)
committerAlekos Filini <alekos.filini@gmail.com>
Wed, 18 Nov 2020 16:23:14 +0000 (17:23 +0100)
README.md
config.toml
content/blog/_index.md [new file with mode: 0644]
content/repl/_index.md
layouts/blog/list.html [new file with mode: 0644]
layouts/partials/tags.html [new file with mode: 0644]
static/css/blog.css [new file with mode: 0644]

index 3acbd2eb43905b65adf293249fc8f229fe4345bf..4c966c512cb15c43559bd7d8a2079aad3371fda6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -28,3 +28,27 @@ the `bdk/target/doc` directory after running the below commands from the `bdk` p
 
 A nightly toolchain is required because some cool features, like `intra_rustdoc_links` and `doc_cfg`, are still
 unstable.
+
+# adding a blog post
+
+Add a markdown file to `content/blog/<year/<name>.md`. At the beginning of the file add the following header:
+
+```
+---
+title: "<post title>"
+description: "<post description>"
+author: "<author>"
+date: "<date in yyyy-mm-dd format>"
+tags: ["<tag1>", "<tag2>]
+hidden: true
+draft: false
+---
+
+```
+
+After that header you can type your post using markdown.
+
+The title will be shown on top of the page, together with the list of tags. The description won't be shown, it's only used
+in the HTML metadata, so if you want to show it, you will have to copy it as part of the content that comes after the header.
+
+If you need to add static data like pictures you can make a folder called `static/blog/<year>/<name>` and store everything you need in there.
index 425ca2e443abdf942bc935525331b8f2f58729dc..4b80e3da0406a1285960fb496e0e3de65c934d68 100644 (file)
@@ -26,7 +26,16 @@ ordersectionsby = "weight"
 # Change default color scheme with a variant one. Can be "red", "blue", "green".
 themeVariant = "blue"
 # Provide a list of custom css files to load relative from the `static/` folder in the site root.
-custom_css = ["css/style.css", "css/jsonview.css"]
+custom_css = ["css/style.css", "css/jsonview.css", "css/blog.css"]
+
+[permalinks]
+tags = "/blog/tags/:slug"
+author = "/blog/author/:slug"
+blog = "/blog/:year/:month/:title/"
+
+[taxonomies]
+tag = "tags"
+author = "author"
 
 # render raw html
 [markup.goldmark.renderer]
diff --git a/content/blog/_index.md b/content/blog/_index.md
new file mode 100644 (file)
index 0000000..8df61f4
--- /dev/null
@@ -0,0 +1,9 @@
++++
+title = "Blog"
+weight = 1
+chapter = false
+pre = '<i class="fas fa-newspaper"></i> '
++++
+
+This blog is used to publish announcements, guides and more regarding the BDK project.
+Anybody can contribute by sending a pull request to our [GitHub repository](https://github.com/bitcoindevkit/bitcoindevkit.org).
index 9a53caf71e17f1c16ebb72c9b70e12342bc26eaf..fd9d9c762dc372362e35df03006b372e0a16d214 100644 (file)
@@ -1,7 +1,7 @@
 +++
 title = "REPL"
 date = 2020-04-28T17:03:00+02:00
-weight = 1
+weight = 5
 chapter = true
 pre = '<i class="fas fa-terminal"></i> '
 +++
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
new file mode 100644 (file)
index 0000000..669a5a2
--- /dev/null
@@ -0,0 +1,25 @@
+{{ partial "header.html" . }}
+
+{{ if eq .Kind "section" }}
+       {{ .Content }}
+{{end}}
+
+{{ range (where .Site.Pages "Type" "blog").GroupByDate "2006" }}
+    <h2>Posts in {{ .Key }}</h2>
+
+    {{ range where .Pages ".Kind" "!=" "section" }}
+        <h3 class="blog-post"><span class="date">{{ .Date.Format "Jan 2" }}</span> <a href="{{ .RelPermalink }}" class="permalink">{{ .Title }}</a></h3>
+        {{ if isset .Params "tags" }}
+       <span class="blog-post-tags">
+            {{ $list := .Params.tags }}
+            {{ $len := (len $list) }}
+
+           Tags: {{ range $index, $elem := $list }}
+                <a href="/blog/tags/{{ $elem | urlize }}">{{ $elem }}</a> {{ if ne (add $index 1) $len }} ยท {{ end }}
+           {{ end }}
+       </span>
+        {{ end }}
+    {{ end }}
+{{ end }}
+
+{{ partial "footer.html" . }}
diff --git a/layouts/partials/tags.html b/layouts/partials/tags.html
new file mode 100644 (file)
index 0000000..75bb3a4
--- /dev/null
@@ -0,0 +1,9 @@
+<!-- Override the default tag from themes/learn/layouts/partials/tags.html to point to the right URL (with the /blog prefix) -->
+
+{{ if .Params.tags }}
+<div class="tags">
+{{range .Params.tags}}
+  <a class="tag-link" href="{{ "/blog/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
+{{end}}
+</div>
+{{end}}
diff --git a/static/css/blog.css b/static/css/blog.css
new file mode 100644 (file)
index 0000000..fe47965
--- /dev/null
@@ -0,0 +1,21 @@
+h3.blog-post {
+    display: flex;
+    align-items: center;
+    margin-bottom: 0;
+}
+
+h3.blog-post > span.date {
+    font-weight: lighter;
+    width: 10vh;
+    display: inline-block;
+    margin-left: 2vh;
+}
+
+span.blog-post-tags {
+    margin-left: 12vh;
+}
+
+a.tag-link::before {
+    left: calc(-1em + 0.5px) !important;
+    top: 0.5px !important;
+}