HUGO

I can not display the new page. But can I display different pages only in layouts, so easy to translate?

Hello,

I concluded the site. As I wanted to create the different pages without content, but it worked nothing. From [ Hugo Multilingual Part 1: Content translation](Hugo Multilingual Part 1: Content translation | Regis Philibert), I decided to create the folder content/{language}/{name-of-page}.md, althought I prefer creating pages inside the folder layouts, so I can translate with the variable i18n from folder data/{language}.yaml. But it did not display the page.

  • Folder content:
content
└── en
    └── colophon
        └── index.md
  • File index.md:
---
aliases: /colophon/
translationKey: colophon
title: Colophon
slug: colophon
---

{{define "main"}}

	{{ if .IsTranslated }}

    # Hello Colophon
			
	{{ end }}

{{ end }}
  • Folder layouts:
layouts
├── 404.html
├── alias.html
├── colophon.html
├── _default
│   ├── baseof.html
│   ├── list.html
│   ├── section.html
│   ├── single.html
│   ├── taxonomy.html
│   └── term.html
├── index.html
└── partials
    ├── footer.html
    ├── header.html
    ├── head.html
    ├── js
    │   └── table-of-themes.html
    ├── md
    │   └── index
    │       └── 1.html
    └── scripts.html
  • File config.yaml:
baseURL: 'https://gusbemacbe.github.io/suru-plus-folders/'
languageCode: en

canonifyURLs: true
relativeURLs: true
uglyURLs: false

title: Suru++ Folders
description: List of Suru++, Adwaita++ and Yaru++ icons tables.
author:
  homepage: 'https://gusbemacbe.pt'
  name: Gustavo Costa
copyright: '© 2019-{{ now.Format "2006" }}, All Rights Reserved'

# Site language. Available translations in the theme's `/i18n` directory.
defaultContentLanguage: en

# Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/
defaultContentLanguageInSubdir: true

# Enable robots.txt generation
enableRobotsTXT: true

enableEmoji: true

enableInlineShortcodes: true

disableKinds:
- taxonomy
- taxonomyTerm

markup:
  asciidocExt:
    backend: html5
    docType: article
    failureLevel: fatal
    safeMode: unsafe
  defaultMarkdownHandler: goldmark
  goldmark:
    extensions:
      definitionList: true
      footnote: true
      linkify: true
      strikethrough: true
      table: true
      taskList: true
      typographer: true
    parser:
      attribute: true
      autoHeadingID: true
      autoHeadingIDType: github
    renderer:
      hardWraps: true
      unsafe: true
      xhtml: true

pygmentsCodefences: true
pygmentsCodefencesGuessSyntax: true
pygmentsUseClassic: true
pygmentsUseClasses: true

assetDir: "static/assets"
layoutDir: layouts
publishDir: "/home/gusbemacbe/GitHub/Gustavo/suru-plus-folders-gh-pages/"
theme: ''

params:
  custom_css:
    - css/colours.css
    - css/fonts.css
    - css/icons.css
    - css/global.css
    - css/header.css
    - css/footer.css
    - css/table.css
    - css/schemes.css
    - css/media-query.css
  custom_js:
    - javascript/themes.js
  custom_js_module: 
    - javascript/sidenavs.js
  custom_js_table: javascript/table-of-themes.js
  custom_js_languages: javascript/languages-switcher.js
  description: List of Suru++, Adwaita++ and Yaru++ icons tables.
  home: Home
  themes:
    - data: theme-light
      name: Default
      weight: 1
    - data: theme-dark
      name: Dark
      weight: 2
    - data: theme-synthwave-84
      name: Synthwave ‘84
      weight: 3
    - data: theme-cyberpunk
      name: Cyberpunk
      weight: 4
    - data: theme-tron
      name: TRON Legacy
      weight: 5
  title: Suru++ Folders

output: "html"

languages:
  en:
    languageName: English
    contentDir: "content/en"
    weight: 1
    menu:
      main:
        - url: /
          name: Home
          weight: 1
        - url: /projects/
          name: Projects
          weight: 2
        - url: /contact/
          name: Contact
          weight: 3
      footer:
        - url: /about/
          name: About
          weight: 1
        - url: /licence/
          name: Licence
          weight: 2
        - url: /privacy/
          name: Privacy
          weight: 3
        - url: /colophon/
          name: Colophon
          weight: 4

  de:
    languageName: Deutsch
    contentDir: "content/de"
    weight: 2
    description: Liste der Tabellen der Adwaita++, Suru++ und Yaru++ thematische Ikonen.
    home: Início
    title: Suru++ Ordner
    menu:
      main:
        - url: /
          name: Start
          weight: 1
        - url: /projekte/
          name: Projekte
          weight: 2
        - url: /kontakt/
          name: Kontakt
          weight: 3
      footer:
        - url: /wer-sind-wir/
          name: Wer sind wir
          weight: 1
        - url: /lizenz/
          name: Lizenz
          weight: 2
        - url: /privatsphare/
          name: Privatsphäre
          weight: 3
        - url: /absprache/
          name: Absprache
          weight: 4
    themes:
      - data: theme-light
        name: Standard
        weight: 1
      - data: theme-dark
        name: Dunkel
        weight: 2
      - data: theme-synthwave-84
        name: Synthwave 1984
        weight: 3
      - data: theme-cyberpunk
        name: Cyberpunk
        weight: 4
      - data: theme-tron
        name: TRON Legacy
        weight: 5

Then I can not display the page with content.

But observe that I prefer creating different pages inside layouts, as colophon.html, and partials/md/colophon/1.md, allowing me to translate with the variable i18n. But it does not display either. But is it possible?

You cannot use template code within your content. Use a shortcode instead.