曦远 (DealiAxy)一份私人的文字刊物

StarBlog
返回文章列表折页手记阅读全文
StarBlog博客开发笔记

StarBlog Development Notes (1): Project Introduction

Preface OK, I'm reinventing the wheel too I've been tinkering with blog systems from the start with WordPress, then later using static blog generators like hexo and hugo hosted on GitHub Tinkering is for solving problems better, and in the end I decided to spend the time building one myself This series of articles will document the blog's development process~ The backend is based on the latest .Net6 and Asp.Net Core frameworks, following RESTFul API conventions. The frontend is developed with Vue+ElementUI, and it can serve as a beginner project for learning .Net Core

曦远 (DealiAxy)约 15 分钟
目录6 个章节

Preface

OK, I'm reinventing the wheel too

I've been tinkering with blog systems from the start with WordPress, then later using static blog generators like hexo and hugo hosted on GitHub

Tinkering is for solving problems better, and in the end I decided to spend the time building one myself

This series of articles will document the blog's development process~

The backend is based on the latest .Net6 and Asp.Net Core frameworks, following RESTFul API conventions. The frontend is developed with Vue+ElementUI, and it can serve as a beginner project for learning .Net Core~

Why Develop My Own Blog

  • I couldn't find an online blog that satisfied me
  • The experience of writing blogs online isn't as good as writing locally with Typora
  • When writing WeChat official account posts, some attention gets diverted to how to write in a way that attracts readers rather than the article itself
  • Only your own website gives you complete control, and it won't be polluted by junk platforms adding unwanted content

Overall Design

Although a blog doesn't have much technical depth, I still want to share my thoughts

One of the reasons I mentioned for developing my own blog is that I like writing blogs locally with Typora. But Markdown, as a plain text format, has a shortcoming when it comes to image resources. Whether you use an image host or link to local files, there's always some hassle when publishing.

Image hosts may go down, and I'm used to keeping resources locally so I can control them myself. But if they're stored locally, publishing to platforms like Blog Garden or WeChat official accounts means uploading images one by one, which is a pain.

Static blog generators can convert Markdown to HTML and then host it on GitHub or Gitee, but the former is almost inaccessible in China, while the latter requires payment for a custom domain, and with stricter controls now, Gitee Pages can no longer be enabled…

Combining the above, the most core point of the blog I'm developing is that it must support local Markdown as well as local images, so I can use my existing hundreds of Markdown documents as-is to build a blog.

I don't want to make a static blog generator—the limitations are too great, and many features such as comments/interaction, update notifications, etc. can't be directly supported.

So the approach is already quite clear: this blog needs to read local Markdown documents, import the document content into the database without modifying the original documents, and at the same time collect resource files (images) from the documents.

Then, for better SEO and also because it's simple, the blog frontend uses server-side rendering and doesn't need frontend-backend separation;

Blog data is all stored in the database, so of course an admin backend is needed. This backend can be made as a frontend-backend separated single-page application.

PS: Originally I only considered writing locally and then uploading. Later I added an online editing feature, which covers basic article editing and the experience is decent

Feature Requirements

So to summarize, the blog developed in this project needs the following features:

  • Batch upload and import of local Markdown articles, parse article categories from the directory structure (supports nested multi-level categories), parse images in Markdown and import them into the website directory
  • Batch upload of local photography works, read image EXIF information and import
  • Configurable blog homepage (display pinned and featured articles, images, and categories)
  • Code snippet editing and sharing
  • The admin backend needs complete editing features for articles, categories, images, and code snippets
  • The blog frontend needs the ability to quickly publish articles to platforms such as WeChat Official Accounts, Zhihu Columns, Blog Garden, Juejin, etc.

OK, that's about it~ More features may be added later when I think of them~

Tech Stack

Django would originally have been the best choice for the backend—it comes with a built-in admin, making it perfect for developing this kind of CMS.

However, I've been getting quite comfortable with C# lately, and I've also been learning AspNetCore, this high-performance web framework, and I find it pretty nice to use. You shouldn't reinvent the wheel with tools that are too simple, otherwise you lose the challenge and don't learn much that's new… So I settled on AspNetCore.

For the frontend I chose Vue, which I've used before. Aside from picking up a bit of React not long ago, my frontend stack hasn't been updated much, so I'll make do with it for a quick implementation first, and later consider refactoring with fun new tech like Blazor or Flutter~

So it's quite clear

  • Backend: C# + AspNetCore
  • ORM: FreeSQL
  • Blog frontend: Bootstrap + Vue + editor.md + bootswatch
  • Admin: Vue + Vuex + VueRouter
  • Admin UI: SCSS + ElementUI

Blog Screenshots

Here are a few screenshots

Blog homepage

image-20220405223550758

Article list

image-20220405223640366

Photography page~~(although I haven't put the photos I took up there yet)~~

image-20220405223717529

Admin backend homepage

image-20220405223232123

Admin article list

image-20220405223925259

Article editing interface

image-20220405224047524

Admin image list

image-20220405224117117

That's all the images for now due to length~

The blog will be deployed and go live soon, and I'll post the demo link then!

_EOF_

StarBlog Development Notes (1): Project Introduction

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

StarBlog博客开发笔记(21):开始开发RESTFul接口

前言 最近电脑坏了,开源项目的进度也受到一些影响 这篇酝酿很久了,作为本系列第二部分(API接口开发)的第一篇,得想一个好的开头,想着想着就鸽了好久,索性不扯那么多了,直接开写吧~ 关于RESTFul 网上很多相关的文章都要把RESTFul历史来龙去脉给复制一遍,所以我这就不重复了,现在主要的HTTP接口风格就俩:RPC和RESTFul。 举个例子就可以看出这俩的区别 RPC风格 分别是增删改查的

2023-01-02 · StarBlog博客开发笔记 · 约 1 分钟

StarBlog博客开发笔记(19):Markdown渲染方案探索

前言 笔者认为,一个博客网站,最核心的是阅读体验。 在开发StarBlog的过程中,最耗时的恰恰也是文章的展示部分功能。 最开始还没研究出来如何很好的使用后端渲染,所以只能先用Editor.md组件做前端渲染,过渡一下。前端渲染我是不满意的,因为性能较差,页面加载出来还会闪一下,有割裂感,影响体验。 现在我已经做出了比较完善的后端渲染方案,前端渲染就可以直接退休了。本文介绍StarBlog博客开发

2022-10-28 · StarBlog博客开发笔记 · 约 1 分钟

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…