I'm really enjoying these tutorials. Great explanations, you cover everything I need to know to have a good foundation and the length of the videos is manageable. The only thing is that the quick zoom-in zoom-out to look at items on the page is making me feel a bit nauseous, just fyi. Everything else is great :D
what's an example of a good use case for dictionaries? the usage here doesn't seem very flexible (unless there's more to it and I'm missing something, which might be the case)
If anyone can clarify when to use blocks (as in the previous baseof.html video) and when to use partials (as in this video) that would be super helpful. Thank you.
Your tutorials are great. I really enjoy watching them. Keep up the good work. One question to partials - How can I use default values inside the partial? E.g. if someone haven't passed myTitle to the partial how can I set a default value inside of the partial. I've tried {{ .myTitle | default "Dummy title" }} but that's not working. Error Msg. can't evaluate field myTitle in type *hugolib.PageOutput
Hey Alexander, good question! You wanna use an if statement to check whether or not a title has been passed into the partial. You could do something like this: {{ if .myTitle }}{{ .myTitle }}{{ else }} default value {{ end }} This checks to see if the .myTitle variable has a value and if it does then it uses that value, otherwise it uses the default value Thanks for the comment!
Thanks for the advice. I did more tests - your solution and mine with default will only work if I'm passing a dictionary to the partial function. If I'm using {{ partial "header" . }} it won't work. I debugged the scope inside of the partial a bit but I still don't know how to solve this. Debugging with printf to show the context as described [here](gohugo.io/templates/template-debugging/). If dictionary is passed I'm having something like map[string]interface {}{ "myTitle": "Title"} with just the scope passed to the partial it looks like &hugolib.PageOutput{Page:(*hugolib.Page)(0xc043782500), ... } The best result to the issue is if i'm passing the context in a dict - probably not the best solution but it is working: {{ partial "header" (dict "context" .) }}
Hello, it kind of looks like you were trying to use a language called Liquid from Shopify when you said {{ .myTitle | default "Dummy title" }}. I'm happy he helped you below!
Please curb the zooming in and out. It makes it harder to follow/listen, and it gets annoying very quickly. Also, it's just unnecessary -- your default zoom is perfect, and it looks great at both the "normal" screen size (not embedded) and full screen. Other than that, excellent content - thank you!
I'm really enjoying these tutorials. Great explanations, you cover everything I need to know to have a good foundation and the length of the videos is manageable. The only thing is that the quick zoom-in zoom-out to look at items on the page is making me feel a bit nauseous, just fyi. Everything else is great :D
What's the difference between partials and the block templates that you described in an earlier video?
what's an example of a good use case for dictionaries? the usage here doesn't seem very flexible (unless there's more to it and I'm missing something, which might be the case)
If anyone can clarify when to use blocks (as in the previous baseof.html video) and when to use partials (as in this video) that would be super helpful. Thank you.
yes, I see some ambiguity and overlapping sometimes using Hugo, for example here.
It seems like blocks are more for the shell of the page and partials are snippets are for injecting into those pages.
How do you choose a theme? which criterias do you use?
how does one feel a kiss?
Your tutorials are great. I really enjoy watching them. Keep up the good work. One question to partials - How can I use default values inside the partial? E.g. if someone haven't passed myTitle to the partial how can I set a default value inside of the partial. I've tried {{ .myTitle | default "Dummy title" }} but that's not working. Error Msg. can't evaluate field myTitle in type *hugolib.PageOutput
Hey Alexander, good question!
You wanna use an if statement to check whether or not a title has been passed into the partial. You could do something like this:
{{ if .myTitle }}{{ .myTitle }}{{ else }} default value {{ end }}
This checks to see if the .myTitle variable has a value and if it does then it uses that value, otherwise it uses the default value
Thanks for the comment!
Thanks for the advice. I did more tests - your solution and mine with default will only work if I'm passing a dictionary to the partial function.
If I'm using {{ partial "header" . }} it won't work. I debugged the scope inside of the partial a bit but I still don't know how to solve this. Debugging with printf to show the context as described [here](gohugo.io/templates/template-debugging/).
If dictionary is passed I'm having something like
map[string]interface {}{ "myTitle": "Title"}
with just the scope passed to the partial it looks like
&hugolib.PageOutput{Page:(*hugolib.Page)(0xc043782500), ... }
The best result to the issue is if i'm passing the context in a dict - probably not the best solution but it is working:
{{ partial "header" (dict "context" .) }}
Hello, it kind of looks like you were trying to use a language called Liquid from Shopify when you said {{ .myTitle | default "Dummy title" }}. I'm happy he helped you below!
I know the first word is Giraffe but you say it way too fast. I think you should say it slower. Jekyll is easier to learn.
Please curb the zooming in and out. It makes it harder to follow/listen, and it gets annoying very quickly. Also, it's just unnecessary -- your default zoom is perfect, and it looks great at both the "normal" screen size (not embedded) and full screen. Other than that, excellent content - thank you!
Somehow I can't watch the video in HD, and zooming really helps me see what he types. I find it useful