Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.3k stars 533 forks source link

Blog system is overly complicated #5778

Open tesar-tech opened 1 month ago

tesar-tech commented 1 month ago

I have realized some drawbacks while creating a blog post.

I admit I might be wrong in some assumptions. In that case, correct me accordingly.

Issues

1. When one wants to create a blog post, there are many unnecessary actions to undergo.

2. There is a lot of repetitive information across the whole post creation process.

3. Generated code (in SomeBlogPost/Code and SomeBlogPost/Examples) is unnecessary to keep in the repository.

Is there a reason not to .gitignore them? What I have found so far:

Proposal

Let the generated files be where they should be.

Simplify the blog post creation process (addresses issues 1 and 2).

Visual explanation:

BlogPosts
├── 2024-10-14_my-first-post.md
├── 2024-10-10_another-great-article.md
├── 2024-10-08_yet-another-post.md
├── 2024-09-30_new-insights-in-tech.md
├── 2024-09-25_exploring-net-core.md
├── media
│   ├── 2024-10-14_my-first-post
│   │   ├── image1.png
│   │   ├── image2.jpg
│   │   └── diagram.svg
│   ├── 2024-10-10_another-great-article
│   │   ├── infographic.png
│   │   └── screenshot.jpg
│   ├── 2024-10-08_yet-another-post
│   │   ├── illustration1.png
│   │   ├── chart.png
│   │   └── icon.jpg
│   ├── 2024-09-30_new-insights-in-tech
│   │   ├── tech_diagram.png
│   │   └── photo.jpg
│   └── 2024-09-25_exploring-net-core
│       ├── architecture.png
│       └── screenshot1.png

Opinions?

stsrki commented 1 month ago

All valid comments. But, it would only work for a portion of it. There are places where we could improve the experience.

We create a separate folder for every blog so that everything is grouped together. If we were to use a YYYY-MM-DD_url-of-the-blog-post.md for all blogs in a single folder, where would examples and code samples go? They would still have to be separated somewhere. So by making them each separated by folder, and by date/arbitrary name, we have a way of easily finding them in the solution explorer.

Examples and Code but be part of the source control because they must be part of the runtime also. And they must be there when the app is built. We don't want to build them every time.

I agree with the polluting the git status comment. We could improve that. But even that is not a problem since as soon as you stage the changes, git will figure it out and remove those files.

Regarding the media files. They must be placed in the wwwroot. Only from there can they be served. Maybe we could make another build process that could copy them from media/filename folder into wwwroot. If we would go that route. Not sure TBH.

tesar-tech commented 1 month ago

Separate folder

The generated files all have unique names, why do we need to keep them in separate folders? For the Index.razor file it's a different, but we can make it YYYY-MM-DD_url-of-the-blog-post.razor. Or (even better idea): we can easily replicate the current structure, just not in the same location as the markdown files.

Examples and Code folder

Excluding them from vcs will not cause building them every time. Only every time someone new clones the repo or when the site is build and deployed. I am not familiar with the deployment system, but I guess it doesn't happen so often. Correct me if I am wrong, but the current build "script" that will generate the Examples and Code is being run before the project is build, so not having Examples and Code before build time isn't really an issue (??)

Media files

Easily done by

      app.UseStaticFiles(new StaticFileOptions
        {
            FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "..","Blazorise.Docs", "Pages","Blog", "media")),
            RequestPath = "/media"
        });

And then this ![alt](media/somePost/img.jpg) will work. No need to create build scrip and move it somewhere else.