2 files changed,
38 insertions(+),
113 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-02-09 15:05:44 +0200
Change ID:
wtsmqwptuuzttwsywxppmnkzpnlqyxuq
Parent:
3f1230b
jump to
| M | lua/blog/init.lua |
| M | lua/blog/pages.lua |
M
lua/blog/init.lua
@@ -33,23 +33,23 @@ file.mkdir(c.build.output)
file.copy_dir(c.build.static, c.build.output) -- write the pages - ---@type lego.Post[] - local posts = vim - .iter(file.list_dir(c.build.posts)) - :map(function(fname) - return post.read_file { c.build.posts, fname } - end) - :totable() - post.sort_by_date(posts) + -- ---@type lego.Post[] + -- local posts = vim + -- .iter(file.list_dir(c.build.posts)) + -- :map(function(fname) + -- return post.read_file { c.build.posts, fname } + -- end) + -- :totable() + -- post.sort_by_date(posts) write("CNAME", c.cname) write("chroma.css", liblego.get_css(c.build.chroma_theme)) - write("sitemap.xml", sitemap.sitemap(posts, { site_url = c.url })) + -- write("sitemap.xml", sitemap.sitemap(posts, { site_url = c.url })) write("style.css", css.style(styles)) write(".nojekyll", "") write_page("404.html", pages.not_found()) - write_page("index.html", pages.home(posts)) - write_page("posts.html", pages.posts(posts)) + write_page("index.html", pages.home()) + -- write_page("posts.html", pages.posts(posts)) write_gopkg("json2go", "https://github.com/olexsmir/json2go") write_gopkg("moviefeed", "https://github.com/olexsmir/moviefeed")@@ -58,21 +58,21 @@ write_gopkg("smutok", "https://github.com/olexsmir/smutok")
write_gopkg("x", "https://github.com/olexsmir/x") -- stylua: ignore - write("feed.xml", rss.rss(posts, { - email = c.email, - name = c.name, - title = c.title, - subtitle = c.feed.subtitle; - feed_url = c.feed.url, - home_url = c.url, - })) + -- write("feed.xml", rss.rss(posts, { + -- email = c.email, + -- name = c.name, + -- title = c.title, + -- subtitle = c.feed.subtitle; + -- feed_url = c.feed.url, + -- home_url = c.url, + -- })) + -- + -- for _, p in pairs(posts) do + -- local phtml = html.render_page(pages.post(p)) + -- write(p.meta.slug .. ".html", phtml) + -- end - for _, p in pairs(posts) do - local phtml = html.render_page(pages.post(p)) - write(p.meta.slug .. ".html", phtml) - end - - file.report_duplicates() + -- file.report_duplicates() end return blog
M
lua/blog/pages.lua
@@ -45,79 +45,29 @@ h.meta { a.attr("property", "og:title"), a.attr("content", o.title) },
h.meta { a.attr("property", "og:type"), a.attr("content", "website") }, }), h.el("body", { a.class "home" }, { - h.el("header", {}, { - h.nav({}, { - h.p({}, { - h.a({ a.class "visual-hidden", a.href "#main" }, { "Skip to content" }), - h.a({ a.href "/" }, { h.text "home" }), - h.a({ a.href "/posts" }, { h.text "posts" }), - h.a({ a.href "/feed.xml" }, { h.text "feed" }), - h.el("button", { a.id "theme-toggle" }, { h.text "๐" }), - }), - }), - }), + -- h.el("header", {}, { + -- h.nav({}, { + -- h.p({}, { + -- h.a({ a.class "visual-hidden", a.href "#main" }, { "Skip to content" }), + -- h.a({ a.href "/" }, { h.text "home" }), + -- h.a({ a.href "/posts" }, { h.text "posts" }), + -- h.a({ a.href "/feed.xml" }, { h.text "feed" }), + -- h.el("button", { a.id "theme-toggle" }, { h.text "๐" }), + -- }), + -- }), + -- }), h.main({ a.id "main" }, o.body), themeSwitcherScript(), }), }) end ----@param iter Iter ----@return string|lego._HtmlNote -local function list_posts(iter) - return h.ul( - { a.class "blog-posts" }, - iter - ---@param post lego.Post - :filter(function(post) - return not (post.hidden or post.hidden_fully) - end) - ---@param post lego.Post - :map(function(post) - return h.li({}, { - h.span({}, { - h.el("i", {}, { h.time(post.meta.date) }), - }), - h.a({ a.href(post.meta.slug) }, { h.text(post.meta.title) }), - }) - end) - :totable() - ) -end - ----@param posts lego.Post[] -function pages.home(posts) +function pages.home() return with_page { title = "olexsmir.xyz", desc = "olexsmir.xyz home page", body = { - h.h2({}, { "Hi, I'm Olex from Ukraine ๐บ๐ฆ" }), - h.p({}, { - "Welcome to my corner of the internet. Here I share what I find interesting. ", - "Hopefully I will maintain the content on this site, not only itโs code.", - }), - h.p({}, { - "Feel free to scroll through the posts below or subscribe to the ", - h.a({ a.href "/feed.xml" }, { "RSS feed" }), - " for updates. ", - "And if you want to say hi, mail me at ", - h.a({ a.href("mailto:" .. c.email) }, { c.email }), - " or message me on ", - h.a({ a.href "https://t.me/olexsmir" }, { "telegram" }), - " if that's your cup of tea.", - }), - h.p({}, { - "If youโre curious what Iโm up to, check out ", - h.a({ a.href "/now" }, { "now" }), - " page, or look through ", - h.a({ a.href "https://github.com/olexsmir" }, { "github" }), - " or ", - h.a({ a.href "https://tangled.org/olexsmir.xyz" }, { "tangled" }), - " accounts.", - }), - h.div({ a.class "recent-posts" }, { - list_posts(vim.iter(posts):take(7)), - }), + h.h2({}, { "TODO make the site" }), }, } end@@ -132,31 +82,6 @@ h.p({}, {
h.text "Go pack to the ", h.a({ a.href "/" }, { h.text "home page" }), }), - }, - } -end - ----@param posts lego.Post[] -function pages.posts(posts) - return with_page { - title = "All olexsmir's posts", - desc = "List of all blog posts on the lego.", - body = { list_posts(vim.iter(posts)) }, - } -end - ----@param post lego.Post -function pages.post(post) - return with_page { - title = post.meta.title, - desc = "Blog post titled: " .. post.meta.title, - has_code = post.content:match "code" ~= nil, - body = { - h.div({ a.class "blog-title" }, { - h.h1({}, { h.text(post.meta.title) }), - h.p({}, { h.time(post.meta.date) }), - }), - h.raw(post.content), }, } end