short
1
Hi guys
I have this itunes.toml in my data folder:
ranking = [ "/songs/luke-bryan/drink-a-beer.md", "/songs/dan-+-shay/10000-hours.md" ]
I want to get rid of /songs/ and .md in my itunes.toml urls so the url will be luke-bryan/drink-a-beer
only. Can i add them in the code below somehow?
{{ range .Site.Data.itunes.ranking }}
{{ $page := $.Site.GetPage . }}
{{ with $page }}
{{ .Title }} , {{ .Permalink }}
{{ end }}
{{ end }}
“/songs” + URL + “.md”. How I do that? Thanks guys.
Use print
and printf
:
{{ print "/songs" .URL ".md" }}
{{ printf "/songs%s.md" .URL }}
1 Like
PS - Your ranking is also correct. 
2 Likes
short
4
thank you for your quick reply 
I can’t figure out where to put it in the code…
{{ range .Site.Data.itunes.ranking }}
{{ $page := $.Site.GetPage . }}
{{ with (printf "/songs/%s.md") .$page }}
{{ .Title }} , {{ .Permalink }}
{{ end }}
{{ end }}
That doesn’t work… hmmm
short
5
It’s working already!
{{ $page := $.Site.GetPage ( printf "/songs/%s.md" . ) }}
this is it… thanks moorereason 
1 Like
system
Closed
6
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.