Skip to content

Commit ee85992

Browse files
committed
Added documentation
1 parent 980ffdf commit ee85992

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This also includes source code snippets. Highlighting is done via [highlight.js]
2020
- [Authorization](./docs/Authorization/Readme.md)
2121
- [Comments](./docs/Comments/Readme.md)
2222
- [Storage Provider](./docs/Storage/Readme.md)
23+
- [Media Upload](./docs/Media/Readme.md)
2324
- [Search Engine Optimization (SEO)](./docs/SEO/Readme.md)
2425
- [Advanced Features](./docs/Features/AdvancedFeatures.md)
2526

docs/Media/Readme.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Media Upload
2+
3+
The blog supports uploading media assets (images, etc.) directly to Azure Blob Storage while writing blog posts.
4+
5+
## Configuration
6+
7+
The following settings in `appsettings.json` control media upload functionality:
8+
9+
```json
10+
{
11+
"ImageStorageProvider": "Azure",
12+
"ImageStorage": {
13+
"AuthenticationMode": "Default",
14+
"ConnectionString": "",
15+
"ServiceUrl": "",
16+
"ContainerName": ""
17+
}
18+
}
19+
```
20+
21+
| Property | Type | Description |
22+
| ------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------- |
23+
| ImageStorageProvider | string | Currently only supports `Azure` for Azure Blob Storage. |
24+
| AuthenticationMode | string | Authentication method - either `Default` for Microsoft Entra ID or `ConnectionString` for connection string auth |
25+
| ConnectionString | string | Azure Storage connection string (only used when AuthenticationMode is `ConnectionString`) |
26+
| ServiceUrl | string | Azure Blob Storage service URL (only used when AuthenticationMode is `Default`) |
27+
| ContainerName | string | Name of the Azure Storage container to store uploaded files. |
28+
29+
## Authentication Methods
30+
31+
### Default Authentication
32+
Uses Microsoft Entra ID (formerly Azure AD) managed identity or default credentials. This requires:
33+
34+
1. Setting up proper RBAC permissions in Azure
35+
2. Configuring the ServiceUrl to point to your storage account
36+
3. No sensitive credentials needed in config
37+
38+
### Connection String Authentication
39+
Uses a storage account connection string for authentication:
40+
41+
1. Get connection string from Azure Portal
42+
2. Add it to the ConnectionString setting
43+
3. No additional Azure setup required
44+
45+
## Usage
46+
47+
1. Start writing a blog post in the markdown editor
48+
2. Drag & drop images onto the editor
49+
3. A dialog appears asking for:
50+
- File name (can include subdirectories)
51+
- Whether to enable browser caching via `Cache-Control` headers (currently set to one week)
52+
4. The image gets uploaded and a markdown image link is inserted
53+
54+
## Performance Note
55+
56+
Currently, the blog software serves images directly from Azure Blob Storage. For better performance and scalability, consider:
57+
58+
- Using Azure CDN in front of the storage account
59+
- Replacing the blob storage URLs with CDN URLs
60+
- Benefits include HTTP/2 support and improved caching

docs/Setup/Configuration.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ The appsettings.json file has a lot of options to customize the content of the b
5757
"ShowInFooter": true,
5858
"ShowSupportMePage": true,
5959
"SupportMePageDescription": "Buy my book here: [My Blazor Book](https://google.com) or please contribute to my open-source project here: [My Awesome Repo](https://github.com) . This can be **markdown**."
60-
}
60+
},
61+
"ImageStorageProvider": "Azure",
62+
"ImageStorage" : {
63+
"AuthenticationMode": "Default",
64+
"ConnectionString": "",
65+
"ServiceUrl": "",
66+
"ContainerName": ""
67+
},
6168
}
6269
```
6370

@@ -94,3 +101,9 @@ The appsettings.json file has a lot of options to customize the content of the b
94101
| ShowReadingIndicator | boolean | If set to `true` (default) a circle indicates the progress when a user reads a blog post (without comments). |
95102
| SimilarBlogPosts | boolean | If set to `true` (default) similar blog posts are shown at the end of a blog post. |
96103
| [SupportMe](./../Donations/Readme.md) | node | Donation sections configuration. If left empty no donation sections will not be shown. |
104+
| [ImageStorageProvider](./../Media/Readme.md) | string | Declares the type of the image storage provider (currently only `Azure`). |
105+
| [ImageStorage](./../Media/Readme.md) | node | Configuration for the image storage provider. |
106+
| AuthenticationMode | string | The authentication mode for the image storage provider. Either `Default` or `ConnectionString` |
107+
| ConnectionString | string | The connection string for the image storage provider. Only used if `AuthenticationMode` is set to `ConnectionString` |
108+
| ServiceUrl | string | The host url of the Azure blob storage. Only used if `AuthenticationMode` is set to `Default` |
109+
| ContainerName | string | The container name for the image storage provider |

src/LinkDotNet.Blog.Web/appsettings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"ImageStorage" : {
4141
"AuthenticationMode": "Default",
4242
"ConnectionString": "",
43+
"ServiceUrl": "",
4344
"ContainerName": ""
4445
},
4546
"ShowReadingIndicator": true,

0 commit comments

Comments
 (0)