okkur / syna

Highly customizable open source theme for Hugo based static websites
https://syna.okkur.org/demo/
Apache License 2.0
252 stars 134 forks source link

how to bypass _global ? #731

Closed JOduMonT closed 4 years ago

JOduMonT commented 4 years ago

Is this a BUG REPORT or FEATURE REQUEST?: kind of a feature request

What happened: I would like to build landing page (so without navbar and any footer) So I taught : it's easy I simply have to make a fragment which exclude _global but then I started reading this and didn't understood how to create a section without _global

What you expected to happen: a fragment called landingpage and/or blank (which you could find in a lot of wordpress theme) which render a blank page (no navbar, no footer, ...)

stp-ip commented 4 years ago

This should be doable by removing everything from the main _global/ directory.

When that is empty you shouldn't have any global fragments, if you then want to have nav and footer on a subsection, the subsection can have its own _global.

As an example (sorry code not on github) https://about.stp-ip.net. The main one is basically just a single member fragment without much else, but the imprint page, does have some more fragments in use: https://about.stp-ip.net/imprint/

As far as I see the request should be possible already. More context, if it doesn't would be appreciated.

JOduMonT commented 4 years ago

by removing everything from the main _global/ directory

ok I got it thank ;)

so I move _global into _index than create the dir _global into every section I want these fragment and make a soft link of copyright, nav, footer and index into these new _global dir. and it work note: I used the ln -s from ./ of the site such as

git clone https://git.okkur.org/syna-start project-name && cd project-name
git submodule init
git submodule update
mv content/_global content/_index/
mkdir content/about/_global
ln -s content/_index/_global/copyright.md content/about/_global/copyright.md
ln -s content/_index/_global/footer.md content/about/_global/footer.md
ln -s content/_index/_global/index.md content/about/_global/index.md
ln -s content/_index/_global/nav.md content/about/_global/nav.md
hugo serve

than, I still have only one _global to maintain ;)

@stp-ip thank for your precise and helpful answer

stp-ip commented 4 years ago

Ah so you specifically want to have the fragments present on your main index page and subsequent pages, but have one page aka the landing page be free from global fragments.

This should work within another method without needing softlinks as well I think. _global/ fragments can be overwritten by empty ones on your landing page. Paging @mpourismaiel to add more context on how to overwrite a fragment to not be present in a subsection.

Glad your workaround is already working.

JOduMonT commented 4 years ago

This should work within another method without needing softlinks as well I think. _global/ fragments can be overwritten by empty ones on your landing page. Paging @mpourismaiel to add more context on how to overwrite a fragment to not be present in a subsection.

I probably missed understood but I tried to leave _global in ./content than superseed it with empty files it in

./content/landingpage/_global/copyright.md
./content/landingpage/_global/footer.md
./content/landingpage/_global/index.md
./content/landingpage/_global/nav.md

but it don't work, when I go on domain.ltd/landingpage/ I still have the navbar, footer and copyright

stp-ip commented 4 years ago

Try with the content for copyright:

+++
fragment = "copyright"
disabled = true
+++

In my mind this should work, if it doesn't we should fix it. Empty files alone can't match on the fragment type.

@mpourismaiel would be able to add specifics. If not I'll take a stab at it in the comings days.

mpourismaiel commented 4 years ago

Why not put the override files in landingpage directly?

content/landingpage/nav.md
stp-ip commented 4 years ago

Good call. Was always thinking about a subsection, but if it's just a landingpage, that would work as well.

[ ] We should document the minimum viable content to overwrite this and in general how one could remove a fragment from a subsection as well as a single page.

stp-ip commented 4 years ago

This now has a separate docs issue: https://github.com/okkur/syna/issues/743

Closing here.

JOduMonT commented 4 years ago

Hi; so I tried to disable copyright for the about page as mentioned but also by writing the file into a subdirectory _global image

without success, the copyright still there when I visit the about page

mpourismaiel commented 4 years ago

@JOduMonT I assume about is a single page and not a list page (page instead of a page section). If so, move about/_global/copyright.md to about/copyright.md and let us know if it works. Global directories are located in list page directories. Single pages do not contain any global directories. So the disabled copyright fragment is not registered. Let us know if the problem persists and if so, we'd appreciate a sample repo.

mpourismaiel commented 4 years ago

@JOduMonT Did the previous comment help?

mpourismaiel commented 4 years ago

@JOduMonT I'm sorry for the confusion. We recently found out that we in fact don't support blocking global fragments. We're adding the feature and I'll create a PR shortly. Just wanted to give a heads up and apologize for the confusion I have caused.