forked from GothenburgBitFactory/tw.org
-
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.
This commit upgrades to Hugo 0.134.1 and enables Bootstrap 5's responsive tables. This effectively makes the entire site responsive. Hugo added support for table render hooks in version 0.134.1 ([release notes](https://github.com/gohugoio/hugo/releases/tag/v0.134.0), [docs](https://gohugo.io/render-hooks/tables/)), which are needed to support Bootstrap 5's responsive tables ([source](gohugoio/hugo#9316 (comment))). Also, make sure the rendered SHAs break correctly on mobile by adding a text-break shortcode.
- Loading branch information
Sebastian Carlos
committed
Sep 7, 2024
1 parent
35cf8f7
commit 8d1c8ae
Showing
7 changed files
with
54 additions
and
54 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
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
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
37 changes: 37 additions & 0 deletions
37
themes/bootstrap/layouts/_default/_markup/render-table.html
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,37 @@ | ||
{{/* | ||
Extends the defaul Hugo table rendering | ||
(https://gohugo.io/render-hooks/tables/#example) to support Bootstrap 5's | ||
responsive tables by adding a wrapper div with a "table-responsive" class and | ||
by adding the class "table" to the table element. | ||
*/}} | ||
<div class="table-responsive"> | ||
<table class="table"> | ||
{{- range $k, $v := .Attributes }} | ||
{{- if $v }} | ||
{{- printf " %s=%q" $k $v | safeHTMLAttr }} | ||
{{- end }} | ||
{{- end }} | ||
<thead> | ||
{{- range .THead }} | ||
<tr> | ||
{{- range . }} | ||
<th {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}> | ||
{{- .Text -}} | ||
</th> | ||
{{- end }} | ||
</tr> | ||
{{- end }} | ||
</thead> | ||
<tbody> | ||
{{- range .TBody }} | ||
<tr> | ||
{{- range . }} | ||
<td {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}> | ||
{{- .Text -}} | ||
</td> | ||
{{- end }} | ||
</tr> | ||
{{- end }} | ||
</tbody> | ||
</table> | ||
</div> |
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
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 @@ | ||
<span class="text-break">{{ .Inner }}</span> |
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