Giter Club home page Giter Club logo

bubdm / blog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linkdotnet/blog

0.0 0.0 0.0 9.43 MB

A blog (engine) completely written in C# and Blazor. It aims to be a simple use and easy to extend platform. Blogposts are written in Markdown and are rendered to HTML. This gives all the flexibility needed to express yourself but also have an easy way of creating posts in the first place.

Home Page: https://steven-giesel.com/

License: MIT License

HTML 21.24% C# 71.18% CSS 5.48% JavaScript 2.10%

blog's Introduction

LinkDotNet.Blog

.NET CodeQL codecov

This is a blog software completely written in C# / Blazor. The aim is to have it configurable as possible.

How does it work

The basic idea is that the content creator writes his posts in markdown language (like this readme file). The markdown will then by translated to HTML and displayed to the client. This gives an easy entry to writing posts with all the flexibility markdown has. This also includes source code snippets. Right now only C# is highlighted properly but other languages can be extended easily as the highlighting is done via highlight.js.

In Action

overview

Setup

Just clone this repository and you are good to go. There are some settings you can tweak. The following chapter will guide you through the possibilities.

appsettings.json

The appsettings.json file has a lot of options to customize the content of the blog. The following table shows which values are used when.

{
  "BlogName": "linkdotnet",
  "GithubAccountUrl": "",
  "LinkedInAccountUrl": "",
  "Introduction": {
    "Description": "Some nice text about yourself. Markup can be used [Github](https://github.com/someuser/somerepo)",
    "BackgroundUrl": "assets/profile-background.webp",
    "ProfilePictureUrl": "assets/profile-picture.webp"
  },
  "PersistenceProvider": "SqlServer",
  "ConnectionString": "",
  "DatabaseName": "",
  "Auth0": {
    "Domain": "",
    "ClientId": "",
    "ClientSecret": ""
  },
  "BlogPostsPerPage": 10,
  "AboutMeProfileInformation": {
    "Name": "Steven Giesel",
    "Heading": "Software Engineer",
    "ProfilePictureUrl": "assets/profile-picture.webp"
  },
  "Giscus": {
    "Repository": "github/repo",
    "RepositoryId": "id",
    "Category": "general",
    "CategoryId": "id"
  }
}
Property Type Description
BlogName string Name of your blog. Is used in the navbar and is used as the title of the page.
GithubAccountUrl string Url to your github account. If not set the navigation link is not shown
LinkedInAccountUrl string Url to your LinkedIn account. If not set the navigation link is not shown
Introduction Is used for the introduction part of the blog
Description MarkdownString Small introduction text for yourself. This is also used for <meta name="description"> tag. For this the markup will be converted to plain text.
BackgroundUrl string Url or path to the background image
ProfilePictureUrl string Url or path to your profile picture
PersistenceProvider string Declares the type of the storage provider (one of the following: SqlServer, SqliteServer, RavenDb, InMemory). More in-depth explanation down below
ConnectionString string Is used for connection to a database. Not used when InMemoryStorageProvider is used
DatabaseName string Name of the database. Only used with RavenDbStorageProvider
Auth0 Configuration for setting up Auth0
Domain string See more details here: https://manage.auth0.com/dashboard/
ClientId string See more details here: https://manage.auth0.com/dashboard/
ClientSecret string See more details here: https://manage.auth0.com/dashboard/
BlogPostsPerPage int Gives the amount of blog posts loaded and display per page. For more the user has to use the navigation
AboutMeProfileInformation node Sets information for the About Me Page. If omitted the page is disabled completely
Name string Name, which is displayed on top of the profile card
Heading string Displayed under the name. For example job title
ProfilePictureUrl string Displayed profile picture
Giscus node Enables the comment section. If left empty the comment secion will not be shown. For more information checkout the section about comments down below

Storage Provider

Currently there are 4 Storage-Provider:

  • InMemory - Basically a list holding your data (per request). If the User hits a hard reload, the data is gone.
  • RavenDb - As the name suggests for RavenDb
  • Sqlite - Based on EF Core, so it can be easily adapted for other Sql Dialects
  • SqlServer - Based on EF Core, so it can be easily adapted for other Sql Dialects

Comment Section

For comments the blog is using giscus. To provide the necessary values head over to https://giscus.app/ and go to the configuration section. There you can enter all the information. You will find a detailed guide on the site.

In short:

After you configured everything on the site, you get the <script> tag which you could embed. The blog needs the following information.

Here you can find an example. This is how the script tag looks on giscus.

<script src="https://giscus.app/client.js"
       data-repo="your_username/reponame"
       data-repo-id="M9/ab=="
       data-category="General"
       data-category-id="AbC==/8_D"
       async>
</script>

Now you can copy/paste those information into the appsettings.json. With the given information abobe your appsettings.json looks like this:

  "Giscus": {
    "Repository": "your_username/reponame",
    "RepositoryId": "M9/ab==",
    "Category": "General",
    "CategoryId": "AbC==/8_D"
  }

Authorization

There is only one real mechanism enabled via Auth0. For more information go to: https://auth0.com/docs/applications

The main advantage of Auth0 is the easy configurable dashboard on their website.

For testing purposes you can use services.UseDummyAuthentication();. This allows every user, who presses Login, to be logged in.

Search Engine Optimization (SEO)

The blog includes some of the most important tags to get indexed by a crawler. Furthermore some aspects of the Open Graph specification are implemented.

Robots.txt

In the wwwroot/ you can find a default robots.txt. It allows that the site gets completely indexed. If you want to tweak that behavior feel free. Also you can provide a sitemap.xml to get a better ranking.

Open Graph Tags

To get better results when for example shared via LinkedIn some of the <meta property="og:tag"> tags are implemented.

The following tags are set depending on the page:

Open Graph Tag Index Display Blog Post
og:title Title of the blog (defined in Introduction) Title of the Blog Post
og:url Url to the index page Url of the page
og:image Background image (defined in Introduction) Yes
og:type article article
og:description Short description in plain text (defined in Introduction) Short Description of Blog Post in plain text

Furthermore the following tags are set:

Tag Index Display Blog Post
Title of the web page Defined in AppConfiguration.BlogName Title of the blogpost
<meta name="keyword" content="" /> not set Tags defined in the Blog Post

blog's People

Contributors

linkdotnet avatar

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.