Statiq.Plugins
0.0.2
dotnet add package Statiq.Plugins --version 0.0.2
NuGet\Install-Package Statiq.Plugins -Version 0.0.2
<PackageReference Include="Statiq.Plugins" Version="0.0.2" />
<PackageVersion Include="Statiq.Plugins" Version="0.0.2" />
<PackageReference Include="Statiq.Plugins" />
paket add Statiq.Plugins --version 0.0.2
#r "nuget: Statiq.Plugins, 0.0.2"
#:package Statiq.Plugins@0.0.2
#addin nuget:?package=Statiq.Plugins&version=0.0.2
#tool nuget:?package=Statiq.Plugins&version=0.0.2
<img src="src/Statiq.Plugins/icon.png" width="30px" /> Statiq Plugins
Various Plugins
Made With
Plugins
- Image Gallery
- Reading Time
Image Gallery
A Statiq shortcode to produce an inline image gallery using Lightbox2.
Add the ImageGalleryConfigurator to your bootstrapper:
return await Bootstrapper
.Factory
.CreateWeb(args)
.AddConfigurator<Bootstrapper>(new ImageGalleryConfigurator())
.RunAsync();
Include the Lightbox2 CSS and JS in your layout (e.g. via CDN):
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.4/css/lightbox.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.4/js/lightbox.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Note: For production use, add Subresource Integrity (SRI)
integrityattributes to the above tags. You can generate the hashes at srihash.org or retrieve them from the cdnjs library page.
Then use the shortcode in any Markdown or Razor content file. Use the raw shortcode syntax (<?! ... ?>) so the body is not pre-processed by Markdown (which would otherwise wrap each line in <p> tags):
<?! ImageGallery Name=my-gallery ?>
/images/photo1.jpg|Caption for photo 1|Image Alt
/images/photo2.jpg|Caption for photo 2
/images/photo3.jpg
<?!/ ImageGallery ?>
Parameters:
| Parameter | Required | Default | Description |
|---|---|---|---|
Name |
No | gallery |
The Lightbox2 gallery group name. Images sharing the same name can be cycled through. |
Class |
No | (none) | Additional CSS class(es) to add to the wrapping <div>. |
AlbumLabel |
No | "Image %1 of %2" |
Text shown below the image count. Use %1 and %2 for current/total. |
WrapAround |
No | false |
Wrap around to the first/last image when navigating past the end/beginning. |
DisableScrolling |
No | false |
Prevent page scrolling while the lightbox is open. |
FadeDuration |
No | 300 |
Duration (ms) of the fade-in/fade-out animation. |
ImageFadeDuration |
No | 300 |
Duration (ms) of the image fade animation. |
ResizeDuration |
No | 700 |
Duration (ms) of the resize animation. |
FitImagesInViewport |
No | true |
Resize images that are larger than the viewport. |
ShowImageNumberLabel |
No | true |
Show the AlbumLabel text in the lightbox. |
MaxWidth |
No | (none) | Maximum width (px) of the lightbox image. |
MaxHeight |
No | (none) | Maximum height (px) of the lightbox image. |
ImageWidth |
No | 100 | The size of the preview images in the gallery |
Content format:
Each line inside the shortcode is one image. Fields are pipe-separated: src, optional title (shown as caption in lightbox), and optional alt (alt text for the lightbox image — falls back to title if omitted).
src
src|title
src|title|alt
The shortcode renders Lightbox2-compatible markup:
<div class="image-gallery">
<a href="/images/photo1.jpg" data-lightbox="my-gallery" data-title="Caption for photo 1" data-alt="Caption for photo 1">
<img src="/images/photo1.jpg" alt="Caption for photo 1" />
</a>
...
</div>
When any Lightbox2 options are provided, a configuration <script> block is also emitted:
<?! ImageGallery Name=my-gallery WrapAround=true AlbumLabel="Photo %1 of %2" ?>
/images/photo1.jpg|Caption for photo 1
/images/photo2.jpg|Caption for photo 2
<?!/ ImageGallery ?>
<script>
lightbox.option({
'wrapAround': true,
'albumLabel': "Photo %1 of %2"
});
</script>
Reading time
Adding reading time estimates to blog posts from @ Jeremy Davis
In your appsettings.json add a new property ReadingSpeed and set it to your desired value:
"ReadingSpeed": 100
You can then override the input/_header.cshtml of your theme and place the calculated time after the tags.
<span>~@Model.GetString("ReadingTime") minutes</span>
Docs
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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 is compatible. 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- HtmlAgilityPack (>= 1.11.72)
- Statiq.Web (>= 1.0.0-beta.60)
-
net7.0
- HtmlAgilityPack (>= 1.11.72)
- Statiq.Web (>= 1.0.0-beta.60)
-
net8.0
- HtmlAgilityPack (>= 1.11.72)
- Statiq.Web (>= 1.0.0-beta.60)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.