-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marthijn van den Heuvel
committed
May 19, 2024
1 parent
d165f5e
commit 6a8e399
Showing
35 changed files
with
1,092 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "nuget" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" | ||
- package-ecosystem: "github-actions" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
env: | ||
DOTNET_NOLOGO: true | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
dotnet-version: [ '8.0.x' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ matrix.dotnet-version }} | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --configuration Release | ||
- name: Test with dotnet | ||
run: dotnet test --configuration Release --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}" | ||
- name: Upload dotnet test results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dotnet-results-${{ matrix.dotnet-version }} | ||
path: TestResults-${{ matrix.dotnet-version }} | ||
# Use always() to always run this step to publish test results when there are test failures | ||
if: ${{ always() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
- "[0-9]+.[0-9]+.[0-9]+-preview" | ||
|
||
env: | ||
DOTNET_NOLOGO: true | ||
NuGetDirectory: ${{ github.workspace}}/nuget/release | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
strategy: | ||
matrix: | ||
dotnet-version: [ '8.0.x' ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ matrix.dotnet-version }} | ||
- name: Set RELEASE_VERSION variable from tag | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- name: Print release version | ||
run: | | ||
echo $RELEASE_VERSION | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --configuration Release /p:Version=${RELEASE_VERSION} | ||
- name: Test | ||
run: dotnet test --configuration Release /p:Version=${RELEASE_VERSION} --no-build | ||
- name: Pack | ||
run: dotnet pack --configuration Release /p:Version=${RELEASE_VERSION} --output ${{ env.NuGetDirectory }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg | ||
- name: Push | ||
run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_API_KEY} | ||
env: | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -396,3 +396,4 @@ FodyWeavers.xsd | |
|
||
# JetBrains Rider | ||
*.sln.iml | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
# Sidio.Sitemap.Blazor | ||
Sidio.Sitemap.Blazor is a lightweight .NET library for generating sitemaps in Blazor applications. | ||
|
||
[![build](https://github.com/marthijn/Sidio.Sitemap.Blazor/actions/workflows/build.yml/badge.svg)](https://github.com/marthijn/Sidio.Sitemap.Blazor/actions/workflows/build.yml) | ||
[![NuGet Version](https://img.shields.io/nuget/v/Sidio.Sitemap.Blazor)](https://www.nuget.org/packages/Sidio.Sitemap.Blazor/) | ||
|
||
# Installation | ||
|
||
Add [the package](https://www.nuget.org/packages/Sidio.Sitemap.Blazor/) to your project. | ||
|
||
# Usage | ||
## Sitemap | ||
|
||
Register services: | ||
```csharp | ||
builder.Services | ||
.AddHttpContextAccessor() | ||
.AddDefaultSitemapServices<HttpContextBaseUrlProvider>(); | ||
``` | ||
Add the following attribute to your components (pages) to include them in the sitemap: | ||
```cshtml | ||
@* default *@ | ||
@attribute [Sitemap] | ||
@* override route url *@ | ||
@attribute [Sitemap("/custom-url")] | ||
@* add change frequency, priority and last modified date *@ | ||
@attribute [Sitemap(null, ChangeFrequency.Daily, 0.5, DateTime.Now)] | ||
``` | ||
|
||
# FAQ | ||
|
||
* Exception: `Unable to resolve service for type 'Microsoft.AspNetCore.Http.IHttpContextAccessor' while attempting to activate 'Sidio.Sitemap.AspNetCore.HttpContextBaseUrlProvider'.` | ||
* Solution: call `services.AddHttpContextAccessor();` to register the `IHttpContextAccessor`. | ||
|
||
# See also | ||
* [Sidio.Sitemap.Core package](https://github.com/marthijn/Sidio.Sitemap.Core) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34902.65 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidio.Sitemap.Blazor", "src\Sidio.Sitemap.Blazor\Sidio.Sitemap.Blazor.csproj", "{3EC7C822-56C4-4366-99DA-A383052184CF}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{EF9E7280-E42F-4A7B-AF09-84409F1FE91A}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{D3E36DBC-190C-4A91-9914-928D7B3E49F9}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{8C908299-1670-4C4B-87EE-A31B1B7E2F1C}" | ||
ProjectSection(SolutionItems) = preProject | ||
.github\workflows\build.yml = .github\workflows\build.yml | ||
.github\workflows\release.yml = .github\workflows\release.yml | ||
EndProjectSection | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{D24E5548-001D-46E1-A486-8FCAA6644819}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{99A2F643-137C-4A6C-9C87-C71DDA94D6C2}" | ||
ProjectSection(SolutionItems) = preProject | ||
LICENSE = LICENSE | ||
README.md = README.md | ||
.gitignore = .gitignore | ||
EndProjectSection | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sidio.Sitemap.Blazor.Examples.WebApp", "src\Sidio.Sitemap.Blazor.Examples.WebApp\Sidio.Sitemap.Blazor.Examples.WebApp.csproj", "{4FD98D09-DC56-49DB-8C6D-1E5B1BE72378}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sidio.Sitemap.Blazor.Tests", "src\Sidio.Sitemap.Blazor.Tests\Sidio.Sitemap.Blazor.Tests.csproj", "{4F514982-175F-4F29-BE4B-70A53232340B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{3EC7C822-56C4-4366-99DA-A383052184CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3EC7C822-56C4-4366-99DA-A383052184CF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3EC7C822-56C4-4366-99DA-A383052184CF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3EC7C822-56C4-4366-99DA-A383052184CF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{4FD98D09-DC56-49DB-8C6D-1E5B1BE72378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4FD98D09-DC56-49DB-8C6D-1E5B1BE72378}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4FD98D09-DC56-49DB-8C6D-1E5B1BE72378}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4FD98D09-DC56-49DB-8C6D-1E5B1BE72378}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{4F514982-175F-4F29-BE4B-70A53232340B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4F514982-175F-4F29-BE4B-70A53232340B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4F514982-175F-4F29-BE4B-70A53232340B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4F514982-175F-4F29-BE4B-70A53232340B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{3EC7C822-56C4-4366-99DA-A383052184CF} = {EF9E7280-E42F-4A7B-AF09-84409F1FE91A} | ||
{4FD98D09-DC56-49DB-8C6D-1E5B1BE72378} = {D24E5548-001D-46E1-A486-8FCAA6644819} | ||
{4F514982-175F-4F29-BE4B-70A53232340B} = {D3E36DBC-190C-4A91-9914-928D7B3E49F9} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {61C3A8F4-09FF-4503-8BE3-2DD7C9574992} | ||
EndGlobalSection | ||
EndGlobal |
20 changes: 20 additions & 0 deletions
20
src/Sidio.Sitemap.Blazor.Examples.WebApp/Components/App.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<base href="/" /> | ||
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" /> | ||
<link rel="stylesheet" href="app.css" /> | ||
<link rel="stylesheet" href="Sidio.Sitemap.Blazor.Examples.WebApp.styles.css" /> | ||
<link rel="icon" type="image/png" href="favicon.png" /> | ||
<HeadOutlet /> | ||
</head> | ||
|
||
<body> | ||
<Routes /> | ||
<script src="_framework/blazor.web.js"></script> | ||
</body> | ||
|
||
</html> |
23 changes: 23 additions & 0 deletions
23
src/Sidio.Sitemap.Blazor.Examples.WebApp/Components/Layout/MainLayout.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@inherits LayoutComponentBase | ||
|
||
<div class="page"> | ||
<div class="sidebar"> | ||
<NavMenu /> | ||
</div> | ||
|
||
<main> | ||
<div class="top-row px-4"> | ||
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a> | ||
</div> | ||
|
||
<article class="content px-4"> | ||
@Body | ||
</article> | ||
</main> | ||
</div> | ||
|
||
<div id="blazor-error-ui"> | ||
An unhandled error has occurred. | ||
<a href="" class="reload">Reload</a> | ||
<a class="dismiss">🗙</a> | ||
</div> |
96 changes: 96 additions & 0 deletions
96
src/Sidio.Sitemap.Blazor.Examples.WebApp/Components/Layout/MainLayout.razor.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
.page { | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
main { | ||
flex: 1; | ||
} | ||
|
||
.sidebar { | ||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); | ||
} | ||
|
||
.top-row { | ||
background-color: #f7f7f7; | ||
border-bottom: 1px solid #d6d5d5; | ||
justify-content: flex-end; | ||
height: 3.5rem; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.top-row ::deep a, .top-row ::deep .btn-link { | ||
white-space: nowrap; | ||
margin-left: 1.5rem; | ||
text-decoration: none; | ||
} | ||
|
||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
.top-row ::deep a:first-child { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
@media (max-width: 640.98px) { | ||
.top-row { | ||
justify-content: space-between; | ||
} | ||
|
||
.top-row ::deep a, .top-row ::deep .btn-link { | ||
margin-left: 0; | ||
} | ||
} | ||
|
||
@media (min-width: 641px) { | ||
.page { | ||
flex-direction: row; | ||
} | ||
|
||
.sidebar { | ||
width: 250px; | ||
height: 100vh; | ||
position: sticky; | ||
top: 0; | ||
} | ||
|
||
.top-row { | ||
position: sticky; | ||
top: 0; | ||
z-index: 1; | ||
} | ||
|
||
.top-row.auth ::deep a:first-child { | ||
flex: 1; | ||
text-align: right; | ||
width: 0; | ||
} | ||
|
||
.top-row, article { | ||
padding-left: 2rem !important; | ||
padding-right: 1.5rem !important; | ||
} | ||
} | ||
|
||
#blazor-error-ui { | ||
background: lightyellow; | ||
bottom: 0; | ||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); | ||
display: none; | ||
left: 0; | ||
padding: 0.6rem 1.25rem 0.7rem 1.25rem; | ||
position: fixed; | ||
width: 100%; | ||
z-index: 1000; | ||
} | ||
|
||
#blazor-error-ui .dismiss { | ||
cursor: pointer; | ||
position: absolute; | ||
right: 0.75rem; | ||
top: 0.5rem; | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Sidio.Sitemap.Blazor.Examples.WebApp/Components/Layout/NavMenu.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<div class="top-row ps-3 navbar navbar-dark"> | ||
<div class="container-fluid"> | ||
<a class="navbar-brand" href="">Sidio.Sitemap.Blazor.Examples.WebApp</a> | ||
</div> | ||
</div> | ||
|
||
<input type="checkbox" title="Navigation menu" class="navbar-toggler" /> | ||
|
||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()"> | ||
<nav class="flex-column"> | ||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> | ||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home | ||
</NavLink> | ||
</div> | ||
|
||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="counter"> | ||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter | ||
</NavLink> | ||
</div> | ||
|
||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="weather"> | ||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather | ||
</NavLink> | ||
</div> | ||
</nav> | ||
</div> | ||
|
Oops, something went wrong.