{"id":24309378,"url":"https://github.com/mgroves/cmsprinkle","last_synced_at":"2025-04-09T16:13:55.194Z","repository":{"id":215161367,"uuid":"725646224","full_name":"mgroves/CMSprinkle","owner":"mgroves","description":" micro-CMS originally built for C# Advent","archived":false,"fork":false,"pushed_at":"2024-01-03T14:38:51.000Z","size":963,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T16:13:48.546Z","etag":null,"topics":["asp-net-core","cms","content-management-system","couchbase","markdown","micro-cms","microcms","razor"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgroves.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-30T15:24:10.000Z","updated_at":"2024-09-05T21:51:27.000Z","dependencies_parsed_at":"2024-01-02T21:58:44.609Z","dependency_job_id":null,"html_url":"https://github.com/mgroves/CMSprinkle","commit_stats":null,"previous_names":["mgroves/cmsprinkle"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgroves%2FCMSprinkle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgroves%2FCMSprinkle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgroves%2FCMSprinkle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgroves%2FCMSprinkle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgroves","download_url":"https://codeload.github.com/mgroves/CMSprinkle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065282,"owners_count":21041872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","cms","content-management-system","couchbase","markdown","micro-cms","microcms","razor"],"created_at":"2025-01-17T05:15:04.891Z","updated_at":"2025-04-09T16:13:55.172Z","avatar_url":"https://github.com/mgroves.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CMSprinkle\n\n![CMSprinkle Tests](https://github.com/mgroves/CMSprinkle/actions/workflows/ci.yml/badge.svg)\n\n## NuGet\n\n| Package | Description | Version\n|----|-----|-----\n| [CMSprinkle](https://www.nuget.org/packages/CMSprinkle) | Core package, required | ![CMSprinkle](https://img.shields.io/nuget/v/CMSprinkle)\n| [CMSprinkle.Couchbase](https://www.nuget.org/packages/CMSprinkle.Couchbase) | Data provider for Couchbase | ![CMSprinkle.Couchbase](https://img.shields.io/nuget/v/CMSprinkle.Couchbase) | \n| [CMSprinkle.SqlServer](https://www.nuget.org/packages/CMSprinkle.SqlServer) | Data provider for SqlServer | ![CMSprinkle.SqlServer](https://img.shields.io/nuget/v/CMSprinkle.SqlServer) | \n\n## Introduction\nCMSprinkle is a micro-CMS (Content Management System) designed for quick integration with ASP.NET Core applications. It allows developers to easily incorporate managed content into ASP.NET MVC Razor pages, perfect for applications requiring a _sprinkle_ of dynamic content management.\n\nThis was born out of the [C# Advent](https://csadvent.christmas), a site with only a _tiny_ bit of content that needed to be managed, but it's too much of a hassle to manage it in static files, especially from a mobile device. A full-blown CMS was also way too much for this use case.\n\n## Features\n- **Easy Integration:** Integrates with ASP.NET Core Razor pages, with a bias towards simplicity.\n- **Authentication Support:** Configurable authentication for managing content: use whatever auth you want.\n- **Flexible Routing:** Default /cmsprinkle base URL but you can change to whatever you want.\n- **Database Support:** Compatible with Couchbase and SQL Server for content storage, whichever you're already using.\n- **Customizable Error Messages:** Define custom messages for content-missing errors.\n- **Minimal tracking:** Content is date/time stamped and stamped with the username who last updated it.\n- **Markdown:** write your content in standard Markdown (using stackedit-js), which is rendered (and sanitized) as HTML\n\n## What you won't get\n- **CMS platform**: CMSprinkle is a _sprinkle_ of content management, not a full-blown CMS, or even a headless CMS. If you need something like that, there are a bajillion better options.\n- **Database Performance focus**: Not of the box, at least. Database access is really simple. You'll have to add indexes yourself, and/or create your own implementation of ICMSprinkleDataService if you really want to squeeze out performance.\n- **Binaries**: No image/video uploading, no binary file storage. Host those wherever, and put the links into your markdown.\n\n## Getting Started\n\nYou can check out the CMSprinkle.Example project to see how CMSprinkle is used.\n\nFollow these steps to integrate CMSprinkle into your ASP.NET Core application:\n\n### 1. Installation\nAdd CMSprinkle to your project via NuGet or by cloning this repository.\n\n### 2. Configuration in _ViewImports.cshtml\nEnsure CMSprinkle is available in your Razor pages by adding it to `_ViewImports.cshtml`:\n\n```cshtml\n@addTagHelper *, CMSprinkle\n```\n\n### 3. Using CMSprinkle in a Razor Page\nIncorporate CMSprinkle in a Razor page as shown below:\n```cshtml\n\u003cdiv\u003e\n    \u003ch2\u003eWelcome to my page\u003c/h1\u003e\n    \n    @* CMSprinkle managed content inclusion *@\n    \u003cCMSprinkle contentKey=\"HelloWorld\" /\u003e\n\u003c/div\u003e\n```\n\n### 4. Configuration\n\nSet up basic configuration in `Program.cs`:\n\n```csharp\n// Add authentication for CMSprinkle\nbuilder.Services.AddTransient\u003cICMSprinkleAuth, YourAuthClass\u003e();\n\n// Configure CMSprinkle options\nbuilder.Services.AddCMSprinkle(options =\u003e\n{\n    // Route prefix for CMS pages (default: \"cmsprinkle\")\n    options.RoutePrefix = \"\u003cyour route prefix\u003e\";\n\n    // Custom message for missing content\n    options.ContentNotFoundMessage = (contentKey) =\u003e $\"ERROR: Can't find {contentKey}, did you add it yet?\";\n});\n```\n\n__Database Connection__\n\nConfigure Couchbase for content storage:\n```csharp\nbuilder.Services.AddCMSprinkleCouchbase(\"\u003cbucket name\u003e\", \"\u003cscope name\u003e\", \"\u003ccollection name\u003e\", createCollectionIfNecessary: true);\n```\nAlternatively, use SQLServer as the provider:\n```csharp\nbuilder.Services.AddCMSprinkleSqlServer(\"\u003csql server connection string\u003e\", \"\u003ctable name\u003e\", \"\u003cschema name\u003e\",  createTableIfNecessary: true);\n```\n\n## Configuration Details\n- **ICMSprinkleAuth**: Interface for configuring authentication. Create an implementation based on your security requirements. If you don't, default behavior is local access only.\n- **RoutePrefix**: Determines the URL segment where CMS managed content is accessible.\n- **ContentNotFoundMessage**: Function to generate custom error messages when content is not found. Helps in debugging content issues.\n\n## What about database [whatever]?\n\nMore providers may be added in the future besides Couchbase and SQL Server.\n\nHowever, implementing your own provider isn't too difficult:\n\n0. Check out the [Contributing](#contributing) section below and the [code of conduct](CODE_OF_CONDUCT.md).\n1. Implement `ICMSprinkleDataService`\n2. (Probably) add a ServiceCollection extension (e.g. `AddCMSprinkle[Whatever]`).\n3. If you plan to implement and then contribute a provider, please make sure you open an issue ahead of time\n4. Please consider writing integration tests (using [testcontainers](https://github.com/testcontainers/testcontainers-dotnet), if possible).\n\n## Contributing\nContributions of all shapes and sizes welcome! Please see the [Contributing Guide](CONTRIBUTING.md) for guidelines on how to contribute.\n\n## License\nCMSprinkle is released under the [MIT License](LICENSE).\n\n# Powered By\n\n* [Couchbase](https://www.couchbase.com/) ([.NET SDK](https://docs.couchbase.com/dotnet-sdk/current/hello-world/start-using-sdk.html)) - for NoSQL storage\n* [Dapper](https://github.com/DapperLib/Dapper) - for SQL Server storage\n* [MarkDig](https://github.com/xoofx/markdig) - for Markdown rendering\n* [HtmlSanitizer](https://github.com/mganss/HtmlSanitizer) - for helping prevent XSS\n* [StackEdit](https://github.com/benweet/stackedit) - for Markdown editing, with [jsdelivr](https://github.com/jsdelivr/jsdelivr) for CDN\n* [NUnit](https://nunit.org/) - for automated tests\n* [Bogus](https://github.com/bchavez/Bogus) - for generating data for tests\n* [FakeItEasy](https://github.com/FakeItEasy/FakeItEasy) - for mocking/fakes in tests\n* [Nito.AsyncEx](https://github.com/StephenCleary/AsyncEx) - for AsyncLazy, used in testing\n* [Testcontainers for .NET](https://github.com/testcontainers/testcontainers-dotnet) - for integration testing\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgroves%2Fcmsprinkle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgroves%2Fcmsprinkle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgroves%2Fcmsprinkle/lists"}