Giter Site home page Giter Site logo

Comments (13)

yoshiharuyamashita avatar yoshiharuyamashita commented on July 19, 2024

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.

k1ngf15h3r avatar k1ngf15h3r commented on July 19, 2024

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.

k1ngf15h3r avatar k1ngf15h3r commented on July 19, 2024

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.

yoshiharuyamashita avatar yoshiharuyamashita commented on July 19, 2024

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.

k1ngf15h3r avatar k1ngf15h3r commented on July 19, 2024

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 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


Reply to this email directly or view it on GitHub
#7 (comment)
.

from blackburn.

yoshiharuyamashita avatar yoshiharuyamashita commented on July 19, 2024

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.

k1ngf15h3r avatar k1ngf15h3r commented on July 19, 2024

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.

k1ngf15h3r avatar k1ngf15h3r commented on July 19, 2024

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.

yoshiharuyamashita avatar yoshiharuyamashita commented on July 19, 2024

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.

k1ngf15h3r avatar k1ngf15h3r commented on July 19, 2024

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.

k1ngf15h3r avatar k1ngf15h3r commented on July 19, 2024

Is it possible to replace the {{ .Content }} with your code to display the content?

from blackburn.

yoshiharuyamashita avatar yoshiharuyamashita commented on July 19, 2024

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).

Content List Template

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).

Single Content Template

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.

k1ngf15h3r avatar k1ngf15h3r commented on July 19, 2024

Really nice =) this works great for me =) doesn't need to change the files, just working now =)

from blackburn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.