Comments (13)
I've followed the section titled "Which Template will be rendered?" here:
https://gohugo.io/templates/content/
So perhaps you could create
"..\YourSite\layouts\section\tutorial.html"
then add something like this in your config.toml:
[[menu.main]]
name = "Tutorials"
pre = "your icon here"
weight = 4
identifier = "tutorial"
url = "/tutorial/"
You can repeat the same steps for your "Scripts" section.
Does this work for you? I'll give it a go at my end when I get a chance.
Cheers!
Yoshi
from blackburn.
Hi Yoshi,
I will test this as soon as possible. Will report you. Thanks for your help
so far.
Greets,
Benjamin
Am 24.02.2016 11:19 schrieb "Yoshiharu Yamashita" <[email protected]
:
I've followed the section titled "Which Template will be rendered?" here:
https://gohugo.io/templates/content/
So perhaps you could create
"..\YourSite\layouts\section\tutorial.html"
then add something like this in your config.toml:
[[menu.main]]
name = "Tutorials"
pre = "your icon here"
weight = 4
identifier = "tutorial"
url = "/tutorial/"You can repeat the same steps for your "Scripts" section.
Does this work for you? I'll give it a go at my end when I get a chance.
Cheers!
Yoshi
—
Reply to this email directly or view it on GitHub
#7 (comment)
.
from blackburn.
Hi Yoshi,
I added the described folders to my site and copied the post/single.html to
the section folder but it was not rendered now. Do I have to specify some
tags so that tutorial section is recognized.
Greets,
Benjamin
Am 24.02.2016 11:19 schrieb "Yoshiharu Yamashita" <[email protected]
:
I've followed the section titled "Which Template will be rendered?" here:
https://gohugo.io/templates/content/
So perhaps you could create
"..\YourSite\layouts\section\tutorial.html"
then add something like this in your config.toml:
[[menu.main]]
name = "Tutorials"
pre = "your icon here"
weight = 4
identifier = "tutorial"
url = "/tutorial/"You can repeat the same steps for your "Scripts" section.
Does this work for you? I'll give it a go at my end when I get a chance.
Cheers!
Yoshi
—
Reply to this email directly or view it on GitHub
#7 (comment)
.
from blackburn.
Hi Benjamin
I added the described folders to my site and copied the post/single.html to
the section folder
So do you now have "YourSite\layouts\section\single.html"?
If so try renaming "single.html" to "tutorial.html" and see if that works.
Cheers
Yoshi
from blackburn.
Yes exactly. Tried renaming but still a blank page when clicking on
tutorial link in menu
Cheers
Am 24.02.2016 13:25 schrieb "Yoshiharu Yamashita" <[email protected]
:
Hi Benjamin
I added the described folders to my site and copied the post/single.html to
the section folderSo do you now have "YourSite\layouts\section\single.html"?
If so try renaming "single.html" to "tutorial.html" and see if that works.
Cheers
Yoshi
—
Reply to this email directly or view it on GitHub
#7 (comment)
.
from blackburn.
OK, I've done a quick test.
I've created:
"..\exampleSite\layouts\section\tutorial.html"
Also I've generated my dummy tutorial content in here:
"..\exampleSite\content\tutorial\tutorial-1.md"
I've added the following:
[[menu.main]]
name = "Tutorials"
pre = "<i class='fa fa-phone fa-fw'></i>"
weight = 4
identifier = "tutorial"
url = "/tutorial/"
to the exampleSite's config.toml.
When I run "hugo server" and click on the Tutorials link, the page shows its content for me.
from blackburn.
Ah I used not section for the folder name I used "tutorial" will tests this
in a few minutes
Am 24.02.2016 13:38 schrieb "Yoshiharu Yamashita" <[email protected]
:
OK, I've done a quick test.
I've created:
"..\exampleSite\layouts\section\tutorial.html"
Also I've generated my dummy tutorial content in here:
"..\exampleSite\content\tutorial\tutorial-1.md"
I've added the following:
[[menu.main]]
name = "Tutorials"
pre = ""
weight = 4
identifier = "tutorial"
url = "/tutorial/"to the exampleSite's config.toml.
When I run "hugo server" and click on the Tutorials link, the page shows
its content for me.—
Reply to this email directly or view it on GitHub
#7 (comment)
.
from blackburn.
Getting this
ERROR: 2016/02/24 13:45:10 general.go:222: Error while rendering section
tutorial: template: section/tutorial.html:11:5: executing
"section/tutorial.html" at <.Content>: Content is not a field of struct
type *hugolib.Node
Can you tell me the content of your template.html?
Cheers
Am 24.02.2016 13:38 schrieb "Yoshiharu Yamashita" <[email protected]
:
OK, I've done a quick test.
I've created:
"..\exampleSite\layouts\section\tutorial.html"
Also I've generated my dummy tutorial content in here:
"..\exampleSite\content\tutorial\tutorial-1.md"
I've added the following:
[[menu.main]]
name = "Tutorials"
pre = ""
weight = 4
identifier = "tutorial"
url = "/tutorial/"to the exampleSite's config.toml.
When I run "hugo server" and click on the Tutorials link, the page shows
its content for me.—
Reply to this email directly or view it on GitHub
#7 (comment)
.
from blackburn.
Ah I wasn't using
{{ .Content }}
in my tutorial.html file. If I do, I get the same error as you. I'll need to investigate what's going on.
Yoshi
from blackburn.
Okay when I remove {{ .Content }}
the site renders but the Content is missing for sure ;) does not need to be fixed quickly, so no stress with it ;)
from blackburn.
Is it possible to replace the {{ .Content }}
with your code to display the content?
from blackburn.
Hi Benjamin
As far as I understand, I think you need:
1 "YourSite\layouts\section\tutorial.html" - in this file you can't use {{ .Content }} (you could customise "\blackburn\layouts\indexes\post.html" to create your tutorial.html).
List pages are of the type "node" and have all the node variables and site variables available to use in the templates.
2 "YourSite\layouts\tutorial\single.html" - in this file you can use {{ .Content }} (you could customise "\blackburn\layouts\post\single.html" for this).
Content pages are of the type "page" and have all the page variables and site variables available to use in the templates.
I think this file is optional as if it were missing, "YourSite\themes\blackburn\layouts_default\single.html" would be used.
Take a look at https://github.com/spf13/spf13.com for example. In spf13's case, "project" is equivalent to your "tutorial" or "script".
He has:
- spf13.com/layouts/section/project.html // No use of {{ .Content }}
- spf13.com/layouts/project/single.html // {{ .Content }} is used here
So I think you can model your site just like this.
I hope this helps.
Yoshi
from blackburn.
Really nice =) this works great for me =) doesn't need to change the files, just working now =)
from blackburn.
Related Issues (20)
- Icons in share.html have the incorrect class name HOT 3
- Welcome back @yoshiharuyamashita!
- Incorrect Google Analytics tags
- Both the demo and personal website seem down
- google plus url format error in layouts/partials/social.html? HOT 2
- Error on serving the site HOT 4
- hugo v0.32.4 works fine serving /post/ directory, not v0.35, not v0.36 HOT 12
- Images missing max-width property HOT 8
- When I click the Posts, my articles don't appear HOT 3
- Can blackburn counts web traffic by busuanzi? HOT 2
- Automatically resize image when it is too large HOT 2
- Two questions: layout, and post directories HOT 2
- Two level menu HOT 3
- cannot deploy to github
- Error when serving site HOT 2
- reading time is not displayed HOT 2
- Author name in each post HOT 1
- side menu is not scrollable
- Home Page Broken with Hugo 0.57 HOT 3
- rss link on menu not formatted
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blackburn.