简体   繁体   中英

Add pages to single page theme

I'm using a single page hugo theme to create a website: https://github.com/escalate/hugo-split-theme . I need the links from the main page to take me to a new page (I need only one or two).

I understand I need to add: 1) permalinks to the config.toml file. I've added that and edited the links section so:

[permalinks]
   page = "/:filename/"  

      # Links
      #
      # Links List #1
      [[params.links]]
        [params.links.list1]
          heading = "testheading"

          [[params.links.list1.link]]
            text = "What, when, where"
            ###dv###me adding stuff to made a new page
            url = "/content/page/details.md"

          [[params.links.list1.link]]
            text = "RSVP"
            ###dv### - TODO - add link to google form
            url = "#"

2) add the page as .md to the content folder, have it say type:"page" at the top with the metadata. I've added this file called details.md to the contents folder. Also made a sub-folder called "page" and added it there.

---
title: When and Where
author: ''
date: ''
slug: when-and-where
categories: []
tags: []
type = "page"
---
test content here

3) add a page.html to the layout folder. Also made a sub-folder called "page" and added it there.

{{ partial "header.html" . }}
{{ .Title }}
{{ with .Params.author }}
{{ . }}
{{ end }} {{ if .Params.date }}
{{ .Date.Format "2006/01/02" }}
{{ end }}
{{ .Content }}
{{ partial "footer.html" . }}

What am I doing wrong? I think I'm mixing up links and pages here... I'm using blogdown in R studio to see this locally and the links don't work. Ideally I want the links to take me to a new page with some details - it will be static... This is my first website, any help greatly appreciated! I know a bit of R and markdowns but not html or anything about making websites.

Thanks very much.

You said "the links don't work." Can you be more specific?

When you build the site, what URL do you get for the "What, when, where" link, for example?

Instead of linking to the markdown file, link to the location of the final HTML page, like so:

      [[params.links.list1.link]]
        text = "What, when, where"
        url = "/page/details/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM