Fanray v1.1.0-preview4 - Pages and Navigation

Today I'm releasing Fanray v1.1.0-preview4. Fanray is now running on .NET Core 3.1 and you can create Pages and Navigation. I've recorded a quick video to demo the gist of it. Leave a comment below if you have any questions and please report any issues back to me on GitHub. Thank you!

Upgrade from Preview 3

If you are running Preview 3, run this upgrade script. The script is also found in the solution's sql folder 1.1-prev3 to prev4.sql . Remember to first backup your database!

/* Upgrade from v1.1-preview3 to v1.1-preview4 */

USE [Fanray]
GO

-----------------
-- Schema Update
-----------------

-- add two columns to Blog_Post table
ALTER TABLE [Blog_Post] ADD [PageLayout] tinyint NULL
GO
ALTER TABLE [Blog_Post] ADD [Nav] nvarchar(max) NULL;
GO

---------------
-- Data Update
---------------

-- update migration history version
UPDATE [__EFMigrationsHistory]
   SET [ProductVersion] = '2.2.4-servicing-10062'
   WHERE MigrationId = '20190318202954_FanV1_1'
GO

-- fix Core_Meta Type value
UPDATE [Core_Meta] SET [Type] = 6 WHERE [Type] = 5 -- Plugin from 5 to 6
GO
UPDATE [Core_Meta] SET [Type] = 5 WHERE [Type] = 4 -- Widget from 4 to 5
GO

-- make sure Editor.md plugin exists
IF NOT EXISTS(select * from [Core_Meta] where [Key] = 'editor.md' and [Type] = 6)
BEGIN
    INSERT INTO [Core_Meta] VALUES(N'editor.md', N'{"language":"en","darkTheme":false,"codeMirrorTheme":"default","active":true,"folder":"Editor.md"}', 6);
END
GO

-- make sure Shortcodes plugin is active
UPDATE [Core_Meta] 
   SET [Value] = N'{"active":true,"folder":"Shortcodes"}'
   WHERE [Type] = 6 and [Key] = 'shortcodes'
GO

-- add page widget areas
INSERT [Core_Meta] ([Key], [Value], [Type]) VALUES (N'page-sidebar1', N'{"id":"page-sidebar1","widgetIds":[]}', 2)
GO
INSERT [Core_Meta] ([Key], [Value], [Type]) VALUES (N'page-sidebar2', N'{"id":"page-sidebar2","widgetIds":[]}', 2)
GO
INSERT [Core_Meta] ([Key], [Value], [Type]) VALUES (N'page-before-content', N'{"id":"page-before-content","widgetIds":[]}', 2)
GO
INSERT [Core_Meta] ([Key], [Value], [Type]) VALUES (N'page-after-content', N'{"id":"page-after-content","widgetIds":[]}', 2)
GO

Feature Highlights

Some of the highlights for this release.

.NET Core 3.1

Upgrading to .NET Core 3.1 from 2.2 has been the most painful upgrade to date. The previous upgrades were mostly ASP.NET changes, but this time there were also many EF Core breaking changes among other things which took some efforts. I still have more to do on the upgrade, such as the new System.Text.Json and C# 8 nullable reference types etc. are yet to be implemented.

Pages

The ability to create simple pages makes Fanray more useful. This feature is inspired by GitHub Wiki which I feel has achieved a good balance of functionality and ease of use. A feature like this could easily become too ambitious and get out of hand to implement, so having used GitHub Wiki I feel I had the right scope of things in mind when I designed this feature.

Navigation

With pages you create, you also want your visitors to be able to navigate to them. I've provided Site Navigation and Page Navigation, one lets visitors navigate the main contents of your site and the other is for pages that have child pages which is useful for things like documentations. I also provided the ability to set the root of the site to display any navigatible resources which are pages, apps and blog categories. Assigning blog categories to site navigation is useful to simulate multi-blog scenario.

Markdown Editor 

For page creation I wanted more control on the content, doing markdown is something developers are all familiar with and it also gives you the ability to do HTML and CSS. I'm always on the lookout for good editors, this time I found Editor.md. It is a pretty decent open source markdown editor, the best I could find at this time. If you know anything as good or better please let me know.

CKEditor

I've also upgraded CKEditor 5 to its latest which is the editor for writing blog post. Some improvements include, 

  • Source code blocks are now supported out of box, previously you had to use a shortcode. This feature is using highlight.js to style your code, but you can still use the shortcode if you prefer the look'n feel of syntaxhighlighter which is what the shortcode uses
  • Resize image, you can now resize images inside the editor
  • Editor toolbar works on mobile or small sized devices now, it shrinks the toolbar to display vertically

SysPlugins

I introduced SysPlugins in this release, these are plugins that are activated by default and cannot be deactivated by user. They are always on because the system depends on them, the new Editor.md plugin is an example of this. There isn't really a difference on how these are created, they just live in a different folder SysPlugins instead of the Plugins folder.

Documentation

I retired the Wiki section of the project on GitHub and created Docs on my site instead, you can find more in depth info on this project there. I also updated the CONTRIBUTING guide if you want to join me on this journey.

Tests

I've revamped the entire test projects, I used to keep two separate projects for each library I test, one for unit tests and one for integration tests. I've now combined the two into one, I've also added a lot more unit tests. The SQLite provider which my integration tests depend on had some issues with the new EF Core stuff, so I ended up writing a separate query for SQLite provider in a few places in the data tier. This is a workaround and if you know a better way to do this please let me know.

Sponsors

I've added sponsor links to my project, if you have a few bucks to help this project out, I'd really appreciate it. Thank you!