Skip to content

Commit 0793862

Browse files
committed
🔧 (main.yaml): add step to delete local data files in GitHub Actions workflow
♻️ (list.html): simplify tag list layout by removing redundant range logic In the GitHub Actions workflow, a new step is added to delete specific local data files. This ensures that unnecessary files do not persist, which can help in maintaining a clean working environment and prevent potential issues with outdated or incorrect data. In the HTML layout for tags, the logic is simplified by removing the 'after 3' range. This change reduces complexity and potential redundancy in the code, making it easier to maintain and understand. The previous logic was likely unnecessary for the current requirements.
1 parent b3a1fa2 commit 0793862

File tree

2 files changed

+17
-33
lines changed

2 files changed

+17
-33
lines changed

.github/workflows/main.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,22 @@ jobs:
345345
346346
env:
347347
LOCAL_IMAGE_PATH: "./_site/"
348+
- name: "Delete Local Data Files"
349+
shell: pwsh
350+
run: |
351+
Write-InfoLog "Deleting all data file files locally..."
352+
Get-ChildItem -Path $env:LOCAL_IMAGE_PATH -Recurse -Include data.captions.*.srt, data.captions.json, data.json, data.index.classifications.json | ForEach-Object {
353+
try {
354+
$count++
355+
Remove-Item -Path $_.FullName -Force
356+
Write-DebugLog "Deleted: $($_.FullName)"
357+
}
358+
catch {
359+
Write-ErrorLog "Error deleting file $($_.FullName): $_"
360+
}
361+
}
362+
env:
363+
LOCAL_IMAGE_PATH: "./_site/resources/"
348364
# - name: "Build NKDAgility Outputs"
349365
# shell: pwsh
350366
# run: ./.powershell/build/Sync-BlobStorageImages.ps1

site/layouts/tags/list.html

+1-33
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<section class="container my-2">
2424
<div class="container">
2525
<div class="row">
26-
{{- range first 3 $sortedPagesWithData }}
26+
{{- range $sortedPagesWithData }}
2727
<div class="col-xl-4 p-2">
2828
{{- if or (eq .page.Type "tags") (eq .page.Type "categories") }}
2929
{{- partial "page-sections/sections-taxonomies-card.html" (dict "site" .Site "context" .page "subTypes" "resources") }}
@@ -59,38 +59,6 @@ <h3 class="ttl-nkdagility h5 text-start" title="{{ $title }}">{{- $title }}</h3>
5959
<h2>Overview of {{ .Title }}</h2>
6060
{{- .Content }}
6161
</div>
62-
{{- range after 3 $sortedPagesWithData }}
63-
<div class="col-xl-4">
64-
{{- if or (eq .page.Type "tags") (eq .page.Type "categories") }}
65-
{{- partial "page-sections/sections-taxonomies-card.html" (dict "site" .Site "context" .page "subTypes" "resources") }}
66-
{{- else }}
67-
{{- $title := .page.Title }}
68-
{{- $description := .page.Description }}
69-
{{- $buttonContent := "Find out More" }}
70-
{{- if .page.Params.card }}
71-
{{- $title = .page.Params.card.title }}
72-
{{- $description = .page.Params.card.content }}
73-
{{- $buttonContent = .page.Params.card.button.content }}
74-
{{- end }}
75-
<!-- layouts/partials/card.html -->
76-
<div class="sectioncards p-2 flex-fill flex-grow-1 h-100">
77-
<div class="card sectioncards flex-fill flex-grow-1 m-3 shadow text-start small border-0 h-100 position-relative">
78-
<div class="card-body p-4 px-20">
79-
<span class="badge text-bg-secondary">{{- title .page.Params.ResourceType }}</span>
80-
<h3 class="ttl-nkdagility h5 text-start" title="{{ $title }}">{{- $title }}</h3>
81-
<div class="card-text text-muted">
82-
{{- $description | markdownify }}
83-
</div>
84-
</div>
85-
<div class="card-footer border-transparent bg-white p-3 border-0 d-flex justify-content-between align-items-center">
86-
<small class="text-body-secondary" title="Affinity to {{ $taxonomyName }} is {{ .score }}%"> <strong class="d-inline-block text-truncate" style="max-width: 150px; vertical-align: middle;"> {{ $taxonomyName }} </strong>: {{ .score }}% </small>
87-
<a href="{{ .page.Permalink }}" class="btn btn-nkdagility p-2" title="More information on {{ .title }}"> {{- $buttonContent }} <i class="fa-solid fa-arrow-right"></i> </a>
88-
</div>
89-
</div>
90-
</div>
91-
{{- end }}
92-
</div>
93-
{{- end }}
9462
</div>
9563
</div>
9664
</section>

0 commit comments

Comments
 (0)