MeshWeaver.ContentCollections
                             
                            
                                2.4.0
                            
                        
                    dotnet add package MeshWeaver.ContentCollections --version 2.4.0
NuGet\Install-Package MeshWeaver.ContentCollections -Version 2.4.0
<PackageReference Include="MeshWeaver.ContentCollections" Version="2.4.0" />
<PackageVersion Include="MeshWeaver.ContentCollections" Version="2.4.0" />
<PackageReference Include="MeshWeaver.ContentCollections" />
paket add MeshWeaver.ContentCollections --version 2.4.0
#r "nuget: MeshWeaver.ContentCollections, 2.4.0"
#:package MeshWeaver.ContentCollections@2.4.0
#addin nuget:?package=MeshWeaver.ContentCollections&version=2.4.0
#tool nuget:?package=MeshWeaver.ContentCollections&version=2.4.0
MeshWeaver.Articles
Overview
MeshWeaver.Articles is a specialized component of the MeshWeaver ecosystem that provides functionality for article content management and rendering. This library enables applications to organize, load, and display Markdown-based articles from file system or other storage providers.
Features
- Markdown-based article content management
- Article collections for organizing content
- Path-based article resolution
- Built-in navigation capabilities
- Catalog functionality for browsing articles
- Resolve IArticleServicefor article operations
- Integration with MeshWeaver UI components
- Extensible storage providers for article content
- Article metadata and properties support
Configuration
In appsettings.json
{
  "ArticleCollections": [
    {
      "Name": "Documentation",
      "DisplayName": "Documentation",
      "DefaultAddress": "app/Documentation",
      "BasePath": "../../modules/Documentation/MeshWeaver.Documentation/Markdown"
    },
    {
      "Name": "Northwind",
      "DisplayName": "Northwind",
      "DefaultAddress": "app/Northwind",
      "BasePath": "../../modules/Northwind/MeshWeaver.Northwind.ViewModel/Markdown"
    }
  ]
}
Configure in Services
// Register Article services
services.AddArticles(options => {
    options.AddFileSystemArticles(
        "Documentation",
        "Documentation",
        "app/Documentation",
        Path.Combine(GetAssemblyLocation(), "Markdown"));
    
    options.AddFileSystemArticles(
        "Samples",
        "Sample Articles",
        "app/Samples",
        Path.Combine(GetAssemblyLocation(), "Samples"));
});
// Configure with ArticleCollections from configuration
var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .Build();
services.AddArticles(config => {
    configuration.GetSection("ArticleCollections")
        .Get<ArticleCollection[]>()
        ?.ToList()
        .ForEach(c => {
            config.AddFileSystemArticles(
                c.Name,
                c.DisplayName,
                c.DefaultAddress,
                c.BasePath);
        });
});
Usage Examples
Loading Articles
// Resolve IArticleService
public class ArticleViewer
{
    private readonly IArticleService _articleService;
    
    public ArticleViewer(IArticleService articleService)
    {
        _articleService = articleService;
    }
    
    // Load a specific article
    public async Task<ArticleContent> ViewArticleAsync(string path)
    {
        var article = await _articleService.GetArticleAsync(path);
        if (article == null)
            throw new ArticleNotFoundException(path);
            
        return article;
    }
    
    // Get article catalog
    public async Task<List<ArticleInfo>> GetCatalogAsync(string collection)
    {
        var catalog = await _articleService.GetCatalogAsync(collection);
        return catalog.Articles.ToList();
    }
}
From Tests
[Fact]
public async Task BasicArticle()
{
    // Get article by path
    var article = await ArticleService.GetArticleAsync($"{Test}/article");
    article.Should().NotBeNull();
    article.Content.Should().NotBeNull();
    article.Content.Should().Contain("Simple Test Article");
    article.Properties.Should().ContainKey("title");
    article.Properties["title"].Should().Be("Test Article");
}
[Fact]
public async Task Catalog()
{
    // Get catalog for a collection
    var catalog = await ArticleService.GetCatalogAsync(Test);
    catalog.Should().NotBeNull();
    catalog.Articles.Should().HaveCount(1);
    
    // Catalog contains article info
    var article = catalog.Articles.First();
    article.Title.Should().Be("Test Article");
    article.Path.Should().Be($"{Test}/article");
    
    // Get the article from catalog
    var articleContent = await ArticleService.GetArticleAsync(article.Path);
    articleContent.Should().NotBeNull();
    articleContent.Content.Should().Contain("Simple Test Article");
}
Key Concepts
- Article Collections: Logical groupings of articles with metadata
- Article Path: Hierarchical identifiers for articles
- Article Catalog: Directory of available articles in a collection
- Article Content: The rendered content and metadata of an article
- Storage Providers: Backend systems that provide article content (file system, database, etc.)
Integration with MeshWeaver
- Works with MeshWeaver.Layout for article rendering
- Integrates with MeshWeaver navigation components
- Supports MeshWeaver.Markdown for content processing
Related Projects
- MeshWeaver.Markdown - Markdown processing
- MeshWeaver.Layout - UI layout for articles
- MeshWeaver.Documentation.Test - Testing utilities
See Also
Refer to the main MeshWeaver documentation for more information about the overall project.
| Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | net9.0 is compatible. 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. | 
- 
                                                    net9.0- Markdig (>= 0.42.0)
- MeshWeaver.Layout (>= 2.4.0)
- MeshWeaver.Markdown (>= 2.4.0)
- MeshWeaver.Mesh.Contract (>= 2.4.0)
 
NuGet packages (5)
Showing the top 5 NuGet packages that depend on MeshWeaver.ContentCollections:
| Package | Downloads | 
|---|---|
| MeshWeaver.Blazor Package Description | |
| MeshWeaver.Connection.Orleans Package Description | |
| MeshWeaver.Hosting.AzureBlob Package Description | |
| MeshWeaver.Hosting.PostgreSql Package Description | |
| MeshWeaver.AI Package Description | 
GitHub repositories
This package is not used by any popular GitHub repositories.