lynMarkdigRenderTest6 1.0.0
dotnet add package lynMarkdigRenderTest6 --version 1.0.0
NuGet\Install-Package lynMarkdigRenderTest6 -Version 1.0.0
<PackageReference Include="lynMarkdigRenderTest6" Version="1.0.0" />
paket add lynMarkdigRenderTest6 --version 1.0.0
#r "nuget: lynMarkdigRenderTest6, 1.0.0"
// Install lynMarkdigRenderTest6 as a Cake Addin #addin nuget:?package=lynMarkdigRenderTest6&version=1.0.0 // Install lynMarkdigRenderTest6 as a Cake Tool #tool nuget:?package=lynMarkdigRenderTest6&version=1.0.0
StaticWebEpiserverPlugin
Generate static website but still use EpiServer as your CMS for your editors
Introduction
Do you need a crisis web or handling peek load of users on your site? I have started develop a add-on for sites using EpiServer that will take everything you publish and make a static version of it. This way you get the instant publishing of a dynamic website and the performance and scalability of static websites in one go. It should (havn't yet test it) be possible to create the pages directory in your EpiServer site making it fully dynamic for things like search and filtering but static for general information.
Pro
- Reliable serverside response time
- Very easy to scale up
- No database dependency for visitor
- No serverside code requried
- Very secure (hard to hack static pages)
- Supports having some pages dynamic and others generated static (see
UseRouting
below) - Supports custom resource types (You can extend default or start from scratch using
<allowedResourceTypes>
) - Event driven page generation, always latest changes on your website (created when editor publish page or block)
Con/limitations
- Only pages inheriting from PageData will trigger page write
- Only block inheriting from BlockBata will trigger page write
- Resource limitations:
- css (only support dependencies declared in url())
- javascript (no dependencies)
What functionality is provided in Plugin?
Below you can read more what StaticWebEpiserverPlugin can do today. If you are missing something or something is not working as expected, please let me know 😃
Generate static pages on publishing of Pages and Blocks
StaticWebEpiserverPlugin uses the PublishedContent event on IContentEvents to listen for changes that are published on your site. This way it will make sure your site is always up to date with what you have published in EpiServer. No need for busting caches or having your website running without cache do always show the lastest information. As long as your pages are inheriting from PageData and your blocks are inheriting from BlockData, StaticWebEpiserver will keep track of your changes.
Generate static pages on running scheduled job
StaticWebEpiserverPlugin are also providing a scheduled job for you to run that will generate alla pages below the home of your website. Pages that are not a child (or a child of a child, and so on) of your startpage it will not be included in the pages generated. To start the job, run the job called "Generate StaticWeb".
Having different views for StaticWeb and normal users
Using DisplayChannel
StaticWeb is registering a displaychannel called "StaticWeb" (See Header.cshtml and Header.staticweb.cshtml for examples on how to use it, can be found in EpiServerStaticWebExample repository). It is perfect for removing functionality that can't be used in a static website (like filitering or search). It also makes it possible for you to view how the page will look and work on the static version.
Using VisitorGroup
StaticWeb is registering a criteria called "StaticWeb user" under "Technical" category so that you can create your own vistor groups. Making it possible to show different content for page generation and other users. If you for example is using StaticWebEpiServerPlugin for create a static emergency/reserve website to use if everything else fails.
How to ignore page or block type?
By inherit from IStaticWebIgnoreGenerate
iterface on a page or block type you will tell StaticWeb NOT to generate a static version of this type when publishing or running the scheduled job.
How to ignore page at runtime?
By inherit from IStaticWebIgnoreGenerateDynamically
iterface on a page type you will tell StaticWebEpiServerPlugin that it MAY or MAY NOT generate a static version of this page when publishing or running the scheduled job.
StaticWebEpiServerPlugin will call method ShouldGenerate
for the page and if it returns true, it will generate a static version of the page when publishing or running the scheduled job.
BUT if it returns false, it will not generate page AND also check (by calling ShouldDeleteGenerated
) if it should remove any previously generated version of this page.
See StandardPage.cs for example on how it can be used.
You can customize it using Events
We want people to be able to modify the use after their own liking. There for we support the use of events on the IStaticWebService. They will be called in the order specified below. You can read more on what is available at Issue #2
Find, download and generate resources
When generating a page, StaticWebEpiserverPlugin will find all client side resources required for the page to work, download them and store them in the output folder along with the pages.
Following markup will searched for resources
- script element (src attribute)
- link element (href attribute)
- a element (href attribute)
- img element (src attribute)
- source element (srcset attribute)
Following resource types will be stored by default
- css (and resources declared in url())
- javascript (no dependencies)
- Web fonts (woff and woff2)
- Images (png, jpg, jpeg, jpe, gif, webp, svg)
- documents (pdf)
- Icons (ico)
- Assembly Resources (WebResource.axd and ScriptResource.axd as long as resulting content type are allowed)
The rest will be ignored.
(Note: You can add or change supported resource types using <allowedResourceTypes>
)
Requirements
- EpiServer 11.15+
- .Net 4.7.2+
- All pages need to inherit from PageData
- All blocks needs to inherit from BlockData
- Website has to return pages, javascript and css as UTF-8
- Must allow visits with user-agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36 StaticWebPlugin/0.1
Installation
NuGet
Add nuget package https://www.nuget.org/packages/StaticWebEpiserverPlugin/ to your solution.
Add below into:
<configSections>
element ofweb.config
<section name="staticweb" type="StaticWebEpiserverPlugin.Configuration.StaticWebConfigurationSection" />
Add below to the same level as
appSettings
element (for example right below the end tag)<staticweb>
<sites>
<add
name="Test Website"
url="http://localhost:49822/"
outputPath="C:\websites\website1\wwwroot"
resourceFolder="cache\v1"
/>
Change
url
andoutputPath
after your needs and you are ready to go 😃You are ready to go 😃
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 0 | 11/24/2020 |