-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for RTL styles by conditionally loading Bootstrap RTL CSS #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -103,7 +103,11 @@ | |||||||||||||||||||||||||||||
| {{ if $langCss }} | ||||||||||||||||||||||||||||||
| <link rel="stylesheet" href="{{ $langCss.RelPermalink }}" /> | ||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||
| {{- if eq (.Site.Language.LanguageDirection | default "ltr") "rtl" }} | ||||||||||||||||||||||||||||||
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.rtl.min.css" rel="stylesheet" integrity="sha384-dpuaG1suU0eT09tx5plTaGMLBsfDLzUCCUXOY2j/LSvXYuG6Bqs43ALlhIqAJVRb" crossorigin="anonymous" /> | ||||||||||||||||||||||||||||||
| {{- else }} | ||||||||||||||||||||||||||||||
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous" /> | ||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||
| <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js" integrity="sha384-j1CDi7MgGQ12Z7Qab0qlWQ/Qqz24Gc6BM0thvEMVjHnfYGF0rmFCozFSxQBxwHKO" crossorigin="anonymous"></script> | ||||||||||||||||||||||||||||||
|
Comment on lines
+106
to
111
|
||||||||||||||||||||||||||||||
| {{- if eq (.Site.Language.LanguageDirection | default "ltr") "rtl" }} | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.rtl.min.css" rel="stylesheet" integrity="sha384-dpuaG1suU0eT09tx5plTaGMLBsfDLzUCCUXOY2j/LSvXYuG6Bqs43ALlhIqAJVRb" crossorigin="anonymous" /> | |
| {{- else }} | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous" /> | |
| {{- end }} | |
| <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js" integrity="sha384-j1CDi7MgGQ12Z7Qab0qlWQ/Qqz24Gc6BM0thvEMVjHnfYGF0rmFCozFSxQBxwHKO" crossorigin="anonymous"></script> | |
| {{- $bootstrapVersion := "5.3.6" -}} | |
| {{- $bootstrapBase := printf "https://cdn.jsdelivr.net/npm/bootstrap@%s/dist" $bootstrapVersion -}} | |
| {{- if eq (.Site.Language.LanguageDirection | default "ltr") "rtl" }} | |
| <link href="{{ $bootstrapBase }}/css/bootstrap.rtl.min.css" rel="stylesheet" integrity="sha384-dpuaG1suU0eT09tx5plTaGMLBsfDLzUCCUXOY2j/LSvXYuG6Bqs43ALlhIqAJVRb" crossorigin="anonymous" /> | |
| {{- else }} | |
| <link href="{{ $bootstrapBase }}/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous" /> | |
| {{- end }} | |
| <script src="{{ $bootstrapBase }}/js/bootstrap.bundle.min.js" integrity="sha384-j1CDi7MgGQ12Z7Qab0qlWQ/Qqz24Gc6BM0thvEMVjHnfYGF0rmFCozFSxQBxwHKO" crossorigin="anonymous"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: nkdAgility/HugoGuides
Length of output: 151
🌐 Web query:
Bootstrap 5.3.6 CDN SRI hash sha384 integrity💡 Result:
I can't find an official published sha384 integrity string for Bootstrap 5.3.6. Use one of these options:
Sources:
[1] Bootstrap — Get started / CDN guidance. (getbootstrap.com)
[2] jsDelivr listing for bootstrap versions (includes 5.3.6). (cdn.jsdelivr.net)
If you want, I can fetch the file and compute the exact sha384 for you now.
Citations:
🌐 Web query:
Bootstrap 5.3.6 release jsdelivr official💡 Result:
Yes — Bootstrap v5.3.6 was released on May 5, 2025, and is available via the official jsDelivr CDN.
Example jsDelivr URLs (replace with other versions as needed):
Sources:
[1] Bootstrap blog — “Bootstrap 5.3.6” (May 5, 2025).
[2] jsDelivr / npm bootstrap package listing.
Recalculate and verify the SRI hashes before merging — they cannot be confirmed against official sources and will break the site if incorrect.
Bootstrap 5.3.6 exists on jsDelivr (released 5 May 2025), so the version is sound. The conditional logic is clean and consistent with line 2. However, the provided SHA384 integrity hashes have no official published reference. If these don't match the actual files on the CDN, the browser will reject the resources and the site will fail to load the stylesheets.
Recalculate the hashes yourself:
Update the
integrityattributes with the actual computed hashes, then verify the links work in a browser before this lands.🤖 Prompt for AI Agents