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

Fragments of page located in subfolder "absorbed" into page one level up instead of constructing subpage #844

Open
boastful-inaba opened this issue Feb 5, 2021 · 3 comments
Labels

Comments

@boastful-inaba
Copy link

boastful-inaba commented Feb 5, 2021

Is this a BUG REPORT or FEATURE REQUEST?:
bug (or I'm unsure about feature?)

What happened:
I'm creating a site with Syna, and one of the things I'm trying to do is pages with subpages under them in the URL schema.
The idea would be that I'd have URLs something like
www.example.com/alpha/
www.example.com/alpha/ichi/
www.example.com/alpha/ni/
www.example.com/alpha/san/
www.example.com/beta/
www.example.com/beta/hitotsu/
www.example.com/beta/futatsu/
etc.
Other Hugo sites seem to be able to do this just OK.
I tried to make this with Syna but got strange results.

I have a directory structure like
content/example/
content/example/index.md
content/example/content.md
content/example/subexample/
content/example/subexample/index.md
content/example/subexample/content.md
content/example/subexample/row.md
(names changed to avoid direct reference to my project in question)

  • index.md are simple front-matter only files with a title and a date
  • content.md in the root example directory is just plain text paragraphs with a simple set of front matter
    -- date is just the creation date from "hugo new"
    -- fragment = "content"
    -- weight = 100
    -- title = "Qwerty"
  • content.md in the subexample directory is basically the same as the content.md in the main example directory, only with some different example text for the body paragraphs and a different title
  • row.md is an Item fragment with some text and is pointing to an image file in my Static/images directory.

Instead of generating a page at
mysite.com/example/
and
mysite.com/example/subexample/
The row.md fragment is "absorbed" into the page showing at
mysite.com/example/
and
mysite.com/example/subexample/ only displays a white blank page. (View Source indicates it's only transmitting a set of empty PRE tags.)

What you expected to happen:
Fragments at the level of the top level page to apply to the top level, and fragments at the sublevel to apply to the sublevel page

How to reproduce it (as minimally and precisely as possible):
Clone the example Syna repository, add a new folder in there with files similar to those above, then run hugo server

Anything else we need to know?:

Environment:

  • Syna Theme version: v0.17.3
  • Hugo version: v0.80.0 extended
  • Others: Running on hugo server locally
@stp-ip
Copy link
Member

stp-ip commented Feb 5, 2021

Subsections work differently in syna as we have to identify a parent page as an actual page compared to a single page made up of various fragments in subdirectories.
In your content/example/directory move index.md to _index.md, that should fix the issue in my view. Hard to check out without a working code example.

Also check out the exampleSite and the various subdirectories included in there.

@stp-ip stp-ip added the question label Feb 5, 2021
@boastful-inaba
Copy link
Author

I cloned syna-start and made a minimal testcase here.

https://github.com/boastful-inaba/syna-start

Changing index.md to _index.md broke things in a different way.

I did look at the exampleSite, and have managed to cargo-cult my way to something sort-of-working, but I don't actually understand what causes one behavior or another.

@stp-ip
Copy link
Member

stp-ip commented Feb 6, 2021

Thanks for the example. Will try to check it out as soon as I have some extended time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants