Skip to content

Commit

Permalink
♻️ (captions): rename caption files for consistency and clarity
Browse files Browse the repository at this point in the history
Rename caption files from "index.captions.*.md" to "captions.*.md"
across various scripts and templates. This change improves file
naming consistency and clarity, making it easier to manage and
understand the purpose of these files. It also simplifies the
file structure by removing the unnecessary "index" prefix,
aligning with common naming conventions.
  • Loading branch information
MrHinsh committed Feb 25, 2025
1 parent 02495db commit a98d465
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .powershell/build/Generate-CombinedCaptions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function Generate-CombinedCaptions {
return
}

$captionsFile = "$videoDir\index.captions.en.md"
$captionsFile = "$videoDir\captions.en.md"
if (Test-Path $captionsFile) {
$videoCaptions = Get-Content -Path $captionsFile -Raw
Write-Host "Loaded captions for $videoId"
Expand Down
2 changes: 1 addition & 1 deletion .powershell/build/Update-YoutubeTranscriptMarkdown.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Update-YoutubeTranscriptMarkdown {
# Perform operations using the extracted part
Write-InfoLog $matchPart

$markdownFile = Join-Path $videoDir "index.captions.$matchPart.md"
$markdownFile = Join-Path $videoDir "captions.$matchPart.md"
$captionPath = Join-Path $videoDir "data.captions.$matchPart.srt"

# Load the video data from data.json if available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ while ($hugoMarkdownQueue.Count -gt 0 -or $hugoMarkdownBatchQueue.Count -gt 0) {
#================Themes, Categories, & TAGS==========================
$BodyContent = $hugoMarkdown.BodyContent
If ($hugoMarkdown.FrontMatter.ResourceType -eq "videos") {
$captionsPath = Join-Path $hugoMarkdown.FolderPath "index.captions.en.md"
$captionsPath = Join-Path $hugoMarkdown.FolderPath "captions.en.md"
if (Test-Path ($captionsPath )) {
$BodyContent = Get-Content $captionsPath -Raw
}
Expand Down Expand Up @@ -234,8 +234,8 @@ while ($hugoMarkdownQueue.Count -gt 0 -or $hugoMarkdownBatchQueue.Count -gt 0) {
}
"videos" {
if ($hugoMarkdown.FrontMatter.Contains('canonicalURL')) {
if ( (Test-Path (Join-Path $hugoMarkdown.FolderPath "index.captions.en.md" ))) {
$transcript = Get-Content -Path (Join-Path $hugoMarkdown.FolderPath "index.captions.en.md" ) -Raw
if ( (Test-Path (Join-Path $hugoMarkdown.FolderPath "captions.en.md" ))) {
$transcript = Get-Content -Path (Join-Path $hugoMarkdown.FolderPath "captions.en.md" ) -Raw
$content = Get-NewPostBasedOnTranscript -ResourceTranscript $transcript
$newTitle = Get-NewTitleBasedOnContent -Content $content
$newDescription = Get-NewDescriptionBasedOnContent -Content $content
Expand Down
80 changes: 36 additions & 44 deletions site/layouts/resources/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,49 @@ <h2 class="mb-4 nkda-heading-secondary">{{- .Params.subtitle | markdownify }}</h
</section>
{{- end }}
{{- define "main" }}
<section class="container my-5" style="max-width: 700px !important">
<div class="ratio ratio-16x9 mb-4">
<iframe
src="https://www.youtube.com/embed/{{.Params.videoId}}"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
</div>
<section class="container my-5" style="max-width: 700px !important">
<div class="ratio ratio-16x9 mb-4">
<iframe src="https://www.youtube.com/embed/{{ .Params.videoId }}" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe>
</div>

{{ $resource := .Resources.GetMatch "index.captions.md" }}
{{ $resource := .Resources.GetMatch "captions.md" }}

<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="content-tab" data-bs-toggle="tab" data-bs-target="#content" type="button" role="tab" aria-controls="content" aria-selected="true">Content</button>
</li>
{{ with $resource }}
<li class="nav-item" role="presentation">
<button class="nav-link" id="transcript-tab" data-bs-toggle="tab" data-bs-target="#{{ .Name }}" type="button" role="tab" aria-controls="transcript" aria-selected="false">Transcript (EN)</button>
</li>
{{ end }}
{{ $resources := .Resources.Match "index.captions.*.md" }}
{{ range $resources }}
{{ $langCode := replace .File.BaseFileName "index.captions." "" }}

<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link" id="transcript-tab" data-bs-toggle="tab" data-bs-target="#{{ .Name }}" type="button" role="tab" aria-controls="transcript" aria-selected="false">Transcript ({{ $langCode }})</button>
<button class="nav-link active" id="content-tab" data-bs-toggle="tab" data-bs-target="#content" type="button" role="tab" aria-controls="content" aria-selected="true">Content</button>
</li>
{{ end }}
</ul>
{{ with $resource }}
<li class="nav-item" role="presentation">
<button class="nav-link" id="transcript-tab" data-bs-toggle="tab" data-bs-target="#{{ .Name }}" type="button" role="tab" aria-controls="transcript" aria-selected="false">Transcript (EN)</button>
</li>
{{ end }}
{{ $resources := .Resources.Match "captions.*.md" }}
{{ range $resources }}
{{ $langCode := replace .File.BaseFileName "captions." "" }}
<li class="nav-item" role="presentation">
<button class="nav-link" id="transcript-tab" data-bs-toggle="tab" data-bs-target="#{{ .Name }}" type="button" role="tab" aria-controls="transcript" aria-selected="false">Transcript ({{ $langCode }})</button>
</li>
{{ end }}
</ul>

<div class="tab-content mt-3" id="myTabContent">
<div class="tab-pane fade show active" id="content" role="tabpanel" aria-labelledby="content-tab">
{{- .Content }}
</div>
{{ with $resource }}
<div class="tab-pane fade" id="{{ .Name }}" role="tabpanel" aria-labelledby="transcript-tab" lang="en">
<div class="tab-content mt-3" id="myTabContent">
<div class="tab-pane fade show active" id="content" role="tabpanel" aria-labelledby="content-tab">
{{- .Content }}
</div>
{{ end }}
{{ range $resources }}
{{ $langCode := replace .File.BaseFileName "index.captions." "" }}
<div class="tab-pane fade" id="{{ .Name }}" role="tabpanel" aria-labelledby="transcript-tab" lang="{{ $langCode }}">
{{- .Content }}
</div>
{{ end }}
</div>


</section>


{{ with $resource }}
<div class="tab-pane fade" id="{{ .Name }}" role="tabpanel" aria-labelledby="transcript-tab" lang="en">
{{- .Content }}
</div>
{{ end }}
{{ range $resources }}
{{ $langCode := replace .File.BaseFileName "captions." "" }}
<div class="tab-pane fade" id="{{ .Name }}" role="tabpanel" aria-labelledby="transcript-tab" lang="{{ $langCode }}">
{{- .Content }}
</div>
{{ end }}
</div>
</section>

<section class="container my-5" style="max-width: 700px !important">
{{- partial "publications/tag-cloud.html" . }}
Expand Down

0 comments on commit a98d465

Please sign in to comment.