Replies: 1 comment 1 reply
-
|
@gitaeron, let me check this issue. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Now it's a issue (#451) and I've create a pull request (#452) for it.
An experience to new people:
#plus issue series number, and this case is#451.And one more thing:
So check everything with considerness and careness.
(#451)in the end of my commit message just like others.Visit my page to get better view
First of all
Before I create a new issue or make a pull request with my code(you can just change it directly), I just want to discuss this issue first to make sure that I wasn't misunderstanding origin code.
Cause I'm not a front-end or back-end developer, and I'm a new in IT : (
So I started a discuss in this neighborhood : )
Environment
Windows 10, - latest hugo
github page
Theme Version
Bilberry-hugo-themeat @5d7f51ba2e174ea45404595fef24f5996e395672Multi Language
I changed
zh-CN.tomltocn.toml.And the content below is the process of how I fix that.
I'll make a pull request after it could be a issue and it's a properly way to fix it.
What happened ?
Issue founded in languages which are not default.
If there's Multi Language, the URL of
seriesis like this:/series
/Second-Language/series
/Third-Language/series
/...../series
But the fact is like this, it will jump to 404 page because URL Error:
So I searched the project and located in
/bilberry-hugo-theme/layouts/_default/series.terms.htmlThat's the reason why the URL is wrong!
So if we can just type the correct URL by self.......
That's impossible lol : )
In fact, I have no idea at first. It's a totally unknown area for me. I almost give up after couple days.
But after I studied similar html inside bilberry theme, I found a thing named
relLangURL.relLangURLis used to add /language-name/ before your URL.For example, in my case:
after you use
relLangURL:About this code here
{{ define "main" }} <div class="content"> <div class="article-wrapper u-cf single"> <a class="bubble" href="{{ "/series/" | relLangURL}}"> <i class="fa fa-fw fa-list-alt"></i> </a> <article class="article"> <div class="content"> <h3>{{ i18n "series" | default "series" }}</h3> <hr> <ul id="all-series"> {{ range $name, $taxonomy := .Site.Taxonomies.series }} {{ $series_name := $name }} {{ $series_path := (printf "/series/%s" (urlize $name)) }} {{ $series_page := site.GetPage $series_path }} {{ if $series_page }} {{ $series_name = $series_page.Title }} {{ end }} <!--add relLangURL here--> <li><a href="{{ $series_path | relLangURL }}">{{ $series_name }} ({{ $taxonomy.Count }})</a></li> {{ end }} </ul> </div> </article> </div> </div> {{ end }}👈👆 Tips: How about we expand the width.... 👆👉
I assumed that this code is for single language user.
{{ $series_path := (printf "/series/%s" (urlize $name)) }}However that's the most case. Maybe the author is coded by purpose, or based on some reason. I don't know, I'm just a noob.
Anyway this is a experience, I wish it could helped no matter this can or can't be a
issueor something, at lease people will searched it in general if they need it, my title is so long lol : )Unexpected behavior
But this is not over.
This
Unexpected behavioris not concerned about addingrelLangURLinseries.terms.html.The problem is about
series shorcode(series list) didn't display / show / appear.First, I located in
/bilberry-hugo-theme/layouts/shortcodes/series.html.The problem caused by specify language itself.
It puts me in the same situation like above case. Took some days.
Then I found
urlizeto solved this.About this code here
{{ $series_name := .Get 0 | urlize }} {{ range $key, $taxonomy := .Site.Taxonomies.series }} <!--add urlize here--> {{ if eq ($key | urlize) $series_name }} <ul> {{ range $taxonomy.Pages.ByDate }} <li hugo-nav="{{ .RelPermalink }}"><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> {{ end }} </ul> {{ end }} {{ end }}👈👆 Tips: How about we expand the width.... 👆👉
In fact the
$series_nameis already usedurlizeat the first line, that's the reason why they didn't equals.I also doesn't know why.
Conclusion
Because I don't know why this,
so I fixed maybe +_+ or it's just fixed in a possibly inappropriate way.
Beta Was this translation helpful? Give feedback.
All reactions