-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit upgdraes 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 111 ([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))).
- Loading branch information
Sebastian Carlos
committed
Sep 7, 2024
1 parent
9b2e178
commit cc6c7e0
Showing
4 changed files
with
51 additions
and
61 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
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