Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base Template with block definitions in partial's does not work #4121

Closed
Siassei opened this issue Nov 26, 2017 · 1 comment
Closed

Base Template with block definitions in partial's does not work #4121

Siassei opened this issue Nov 26, 2017 · 1 comment

Comments

@Siassei
Copy link

@Siassei Siassei commented Nov 26, 2017

project structure

- content
  - info
    - _index.md
    - about.md
- themes/abc/layouts
  - _default
    - baseof.html
    - list.html
    - single.html
  - info
    - baseof.html
    - list.html
    - single.html

_default/baseof.html

<!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}">
  <head>
    {{ partial "head.html" . }}
  </head>
	<body class="is-loading">

  <div id="wrapper">
    <header id="header">
      {{ partial "header.html" . }}
    </header>

    <div id="main">
      {{ partial "menu-top.html" . }}
      {{ partial "alter-hline.html" . }}
      {{ partial "content.html" . }}
    </div>

    <footer id="footer">
      {{ partial "footer.html" . }}
    </footer>
  </div>

  <div id="bg"></div>

	</body>
</html>

partials/content.html

<div id="content">
  <div id="sidebar-left">
    {{ block "content-sidebar-left" . }}
    {{ end }}
  </div>
  <div id="view">
    {{ block "content-view" . }}
    <h1>{{ .Type }}-baseof</h1>
    {{ end }}
  </div>
  <div id="sidebar-right">
    {{ block "content-sidebar-right" . }}
    {{ end }}
  </div>
</div>
  1. themes/abc/layouts/info/baseof.html
    If that file only contains lines as above, the info/baseof.html do not replace the block at the default/baseof.html.
    {{ define "content-view" }}abcd{{ end }}
    That is very ugly and breaks for me a lot of power. Why I can not "subtheming" the base-template for different sections with block syntax?
    (maybe the problem contains on the effect of question 2?)

  2. If themes/abc/layouts/info/baseof.html is delete then the block definitions in the partial "content.html" do not work correctly. Hugo does not match the present "info/....html" files for the info content of the project. The output for e.g. "content-view" is the default output <h1>info-baseof</h1>
    If I put the lines of the partial into the _default/baseof.html then the info content use the "info/....html" layouts.

@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Nov 26, 2017

Block definitions in partials aren't supported.

If you want to discuss alternatives, ask at https://discourse.gohugo.io/

@bep bep closed this Nov 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.