diff --git a/docs/en/configuration.md b/docs/en/configuration.md
index b2c92bb..0cca637 100644
--- a/docs/en/configuration.md
+++ b/docs/en/configuration.md
@@ -23,7 +23,8 @@ builder.Services.AddEnfilade(shell => shell.Appearance = Appearance.System);
| Option | Default | Description |
| ----------------------- | ------------ | ----------------------------------------------- |
| `Brand` | `Enfilade` | Name in the navigation and document titles. |
-| `ShowVersion` | `true` | Shows the Enfilade version under the brand. |
+| `ShowVersion` | `true` | Shows the version under the brand. |
+| `Version` | — | Version to display. Defaults to the Enfilade version. |
| `Favicon` | — | Static asset path of the icon. |
| `Language` | `en` | Default language. Must be one of `Languages`. |
| `Languages` | — | Languages offered in the switch. |
diff --git a/docs/ru/configuration.md b/docs/ru/configuration.md
index 05bf8f6..56f4406 100644
--- a/docs/ru/configuration.md
+++ b/docs/ru/configuration.md
@@ -23,7 +23,8 @@ builder.Services.AddEnfilade(shell => shell.Appearance = Appearance.System);
| Параметр | По умолчанию | Описание |
| ----------------------- | ------------ | ----------------------------------------------- |
| `Brand` | `Enfilade` | Название в навигации и в заголовках документов. |
-| `ShowVersion` | `true` | Показывает версию Enfilade под названием. |
+| `ShowVersion` | `true` | Показывает версию под названием. |
+| `Version` | — | Версия для отображения. По умолчанию используется версия Enfilade. |
| `Favicon` | — | Путь к значку среди статических файлов. |
| `Language` | `en` | Язык по умолчанию. Должен входить в `Languages`. |
| `Languages` | — | Языки, предлагаемые в переключателе. |
diff --git a/src/Enfilade/EnfiladeOptions.cs b/src/Enfilade/EnfiladeOptions.cs
index 05de848..028dd3e 100644
--- a/src/Enfilade/EnfiladeOptions.cs
+++ b/src/Enfilade/EnfiladeOptions.cs
@@ -14,6 +14,8 @@ public sealed partial class EnfiladeOptions
public bool ShowVersion { get; set; } = true;
+ public string? Version { get; set; }
+
public string? Favicon { get; set; }
public string Language { get; set; } = "en";
diff --git a/src/Enfilade/Layout/MainLayout.razor b/src/Enfilade/Layout/MainLayout.razor
index 64df517..aed5566 100644
--- a/src/Enfilade/Layout/MainLayout.razor
+++ b/src/Enfilade/Layout/MainLayout.razor
@@ -15,7 +15,7 @@
@Options.Value.Brand
@if (Options.Value.ShowVersion)
{
- @Words.Format(EnfiladeText.Version, LibraryVersion)
+ @Words.Format(EnfiladeText.Version, Options.Value.Version ?? LibraryVersion)
}
diff --git a/tests/Enfilade.Tests/VersionTests.cs b/tests/Enfilade.Tests/VersionTests.cs
new file mode 100644
index 0000000..73b8055
--- /dev/null
+++ b/tests/Enfilade.Tests/VersionTests.cs
@@ -0,0 +1,42 @@
+using System.Reflection;
+using Enfilade.Layout;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Enfilade.Tests;
+
+public class VersionTests : PanelContext
+{
+ [Theory]
+ [InlineData(null)]
+ [InlineData("1.2.3-rc.1")]
+ public void The_layout_shows_the_configured_version_or_the_library_version(string? version)
+ {
+ ConfigureVersion(version, showVersion: true);
+ var expected = version ?? typeof(MainLayout).Assembly
+ .GetCustomAttribute()!.InformationalVersion.Split('+')[0];
+
+ var layout = Render();
+
+ Assert.EndsWith(expected, layout.Find(".version").TextContent, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void The_layout_hides_a_configured_version_when_disabled()
+ {
+ ConfigureVersion("1.2.3", showVersion: false);
+
+ var layout = Render();
+
+ Assert.Empty(layout.FindAll(".version"));
+ }
+
+ private void ConfigureVersion(string? version, bool showVersion)
+ {
+ AddAuthorization();
+ var settings = new Dictionary { ["Enfilade:ShowVersion"] = showVersion.ToString() };
+ if (version is not null)
+ settings["Enfilade:Version"] = version;
+ Services.AddSingleton(new ConfigurationBuilder().AddInMemoryCollection(settings).Build());
+ }
+}