Code Monkey home page Code Monkey logo

bloggo's Introduction

Kevin is a software engineer working on stuff such as distributed systems, identity management and developer experience. He has been programming since the late 2000s after failing to cheat on a videogame called Lineage II.

In his free time, he likes to work on his own free and open-source projects; which you can find on his blog as it documents some of his work. Here's a list of projects he has worked over the years. His current hobbies outside programming include simracing, hiking and in the near future playing an instrument.

Carrer wise he would like to start moving from the Web Development space to in his view, a more challenging area like Computer Graphics, Compilers or Operating Systems.

bloggo's People

Contributors

dependabot[bot] avatar jahanvi128 avatar kevinsuner avatar

Forkers

jahanvi128

bloggo's Issues

themes/bloggo: Fix the delay when switching between dark/light mode and navigating to another page

At this moment, the way the Bloggo theme is switching between dark and light mode is by using a custom script located at the header, and using the window.onload event to trigger a function that determines which theme and theme-icon need to be set. Prior to this, the script was located in the footer template and worked just fine, but since now we are waiting for the whole page to load (including resources such as stylesheets, scripts, iframes, and images), the content gets displayed using the previous theme, and then after some milliseconds switches to the correct one.

Add update, generate and test commands

When creating the bloggo-demo repository, I noticed that the process of getting changes from upstream is not as ideal as I will wanted it to be, as I had to delete pretty much everything manually minus some specific files, and then re-generate the public folder.

To solve this problem I'm thinking of using Cobra to implement three separated commands:

  • bloggo update Performs a git clone of Bloggo's master branch in a temporal folder, removes all folders minus user installed themes (bloggo theme comes by default, so it will get deleted too) and content.
  • bloggo generate Generates the public directory and converts every Markdown file to HTML using go templates
  • bloggo test Spins an HTTP server to serve the content contained in the public directory

generator: Fix map not being properly sorted

At the moment the way the archive map is being created is by using the [year] part in the metadata.PublishedTime struct field as the key, and appending to it a post struct. This is happening inside a for-loop that iterates over a previously sorted []post array, so the inserts that are occurring on the archive map are being performed on a ordered way, but when printing out the map itself, the order appears to have been reversed and instead of it being [2018, 2017, 2016] is [2016, 2017, 2018]. This could be due to how maps are implemented in Go, or me not understanding them, so I'm thinking that it would be great to stop using a map and implement something along this lines Iterate over map.

Replace the current generator with a proper renderer

The way Bloggo is currently generating the index, about and archive pages under the hood is by having a specific receiver function per each one of them. Like this:

package main

import "fmt"

type Generator struct {
    BaseURL string
}

func (g *Generator) Index() {
    fmt.Println(g.BaseURL)
}

func (g *Generator) About() {
    fmt.Println(g.BaseURL)
}

func (g *Generator) Archive() {
    fmt.Println(g.BaseURL)
}

Although this solution works, from an extensibility and maintainability standpoint it wouldn't be wise to keep it as it is. In-order to tackle this problem the current generator must be replaced by a proper render package that accomplishes the aforementioned things.

The inner workings of the renderer are as straightforward as they can be, it profits from the user provided configuration and the metadata contained in the .md file to determine which options must be used when rendering.

flowchart LR
    1[config]-->2["render(...opts)"]
    3[markdown]-->4[frontmatter]-->2
    2-->5[html]

And it does not go against the KISS principle that Bloggo follows, because there will be a limit in the amount of options that users can provide in the configuration file. So, in the end index, about and archive will be the only pages that get rendered, but each one of them will be greatly customizable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.