-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
CSV Table not found with i18n #2906
Comments
This issue is stale because it has not had any recent activity. The resources of the project maintainers are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the If this is a feature request, and you feel that it is still relevant and valuable, consider contributing a Pull Request for review. This issue will automatically close soon if no further activity occurs. Thank you for your contributions. |
Unfortunately, looks like #2919 did not solve this issue. |
Hi, I did some test, and maybe I came up with something.
# Default language
en:
languageCode: en
contentDir: content/en
# At least another language, even if you do not use that
it:
languageCode: it
contentDir: content/it
defaultContentLanguageInSubdir: true
{{/* Table Shortcode for Wowchemy. */}}
{{/* Load a CSV table from page dir falling back back to remote URL */}}
{{/* Defaults to expecting a comma-separated CSV with a header row. */}}
{{/*
Docs: https://wowchemy.com/docs/content/writing-markdown-latex/#csv-table
Parameters
----------
src :
Path or url to the csv table. Path is relative to the folder where the shortcode is called.
delimiter : default ","
Field delimiter.
header : default "true"
If "true", the first row is rendered as the header.
caption : optional
Caption for the table.
*/}}
{{ $src := .Get "path" }}
{{ $delimiter := .Get "delimiter" | default "," }}
{{ $useHeaderRow := (eq (lower (.Get "header")) "true") | default true }}
{{ $caption := .Get "caption" }}
{{ $is_remote := strings.HasPrefix $src "http" }}
{{ if not $is_remote }}
{{ $src = path.Join "content" $.Page.RelPermalink $src }}
{{ end }}
{{ $rows := getCSV $delimiter $src }}
<table class="table">
{{ if $useHeaderRow }}
{{ $headerRow := index $rows 0 }}
{{ $rows = after 1 $rows }}
<tr> {{ range $headerRow }} <th>{{ . | markdownify | emojify }}</th> {{ end }} </tr>
{{ end }}
{{ range $rows }}
<tr>
{{ range . }}
{{ if (findRE "^\\d+$" .) }}
<td data-table-dtype="number">{{ . }}</td>
{{ else }}
<td data-table-dtype="text">{{ . | markdownify | emojify }}</td>
{{ end }}
{{ end }}
</tr>
{{ end }}
{{ if $caption }}
<caption>{{ $caption | markdownify | emojify }}</caption>
{{ end }}
</table>
Let me know if this helps you! |
Unfortunately this did not work here. I also tried something like the following without success: |
This issue is stale because it has not had any recent activity. The resources of the project maintainers are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the If this is a feature request, and you feel that it is still relevant and valuable, consider contributing a Pull Request for review. This issue will automatically close soon if no further activity occurs. Thank you for your contributions. |
Preliminary Checks
Description
Relative paths as done in the documentation don't work in multi-language websites.
Reproduction Link
https://github.com/jbsilva/starter-hugo-academic
Steps to Reproduce
starter-hugo-academic
repocontent/en
contentDir: content/en
inconfig/_default/languages.yaml
hugo server
Expected Result
Hugo should build the website correctly and recognize that
results.csv
is undercontent/en/
.The correct path would be
content/en/post/writing-technical-content/results.csv
Actual Result
What Hugo Module versions does your site use?
What operating system(s) are you seeing the problem on?
Linux
What browser(s) are you seeing the problem on?
Firefox
Which Wowchemy template are you using?
Academic
What version of Hugo are you using?
hugo v0.109.0+extended
The text was updated successfully, but these errors were encountered: