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

Add flexibility to index.html to be used in subdirectories #196

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

chatziko
Copy link
Contributor

@chatziko chatziko commented Jul 1, 2024

This is a simple PR that does not change the theme's behaviour for existing users in any way (the example page renders exactly the same).

On the other hand, it adds the flexibility of reusing the scrolling index.html template in multiple pages (not just the homepage) in a very simple way:

  • create subdir directory with a subdir/_index.md file (i.e. a hugo section)
  • Add layout: index in subdir/_index.md to instruct hugo to use the _default/index.html template.
  • Place sections in subdir/homepage/<section>.md as usual

An example can be found in this commit (not part of the PR).

The changes are straightforward:

  • use a relative ./homepage instead of /homepage
  • Create a language menu using the translations of the current page (not the whole site)
  • Move index.html inside _default so that it can be re-used.
  • Use the .Parent page in back links instead of the root page.

I don't know if you'd like to have full support for multiple scrolling pages in the future, or you prefer to keep the theme simple. But in any case this PR is simple and only adds flexibility, so I hope it can be merged.

@zjedi
Copy link
Owner

zjedi commented Jul 1, 2024

Always good idea to add more flexibility, I just wonder what is the use case? Do you have an example published already somewhere?

Are you aiming to produce separate pages of the same template? Or is it going to be somehow interlinked?

@chatziko
Copy link
Contributor Author

chatziko commented Jul 2, 2024

Here's an example:

It's a single site for a theater company. Each actor has lots of info in several sub-sections, so it makes sense to have their own scrolling subdirectory page (a single internal page would look too flat and packed). These subdirectories are still part of the company site, so there's a "back" link to the homepage.

@zjedi
Copy link
Owner

zjedi commented Jul 5, 2024

Interesting. It's like multiple websites sharing the theme. Perhaps you are also touching the topic of redesigning the "detail" pages #116 , which is currently of trivial nature. I can imagine we abondon it completely in favor of your solution.

Just throwing in some ideas how this could be developed in the future:

  • add "back" button to the top of left menu when in the detail.
  • add "detail" links to sub-categories to the left menu when at the main page.
  • option to turn off landing image part, or maybe have a smaller alternative that would be handy for "subsites"

Let me know what you think of the navigation.

There's a small conflict by the way :)

@chatziko
Copy link
Contributor Author

chatziko commented Jul 5, 2024

I fixed the conflict (trivial one introduced by #197).

I'm actually using all 3 types of pages:

  • Homepage
    The starting point, represents the whole company
  • Internal scrolling page
    A section of the site (eg representing a single actor) with a lot of different types of content to justify its own scrolling page. (In principle these can be nested for large sites.)
  • Detail page
    Suitable for a single piece of information, that is too big to fit in a section of a scrolling page, but too small to justify its own scrolling page. The "back" link goes to its parent (which can be either the homepage or an internal scrolling page).

I think having all three should cover most needs of small-to-medium websites. And of course someone could choose to use only a subset of them, eg not use detail pages and use internal scrolling pages instead.

We should use clear and consistent names for these btw.

  • I guess "homepage" and "detailed" page are already used, which are fine.
  • "Section" should be reserved for the elements of the scrolling page.
  • Maybe the "internal scrolling page" could be called "segment" or something?

I would propose the following plan to move forward:

  • Merge this PR
  • Include a minimal internal scrolling page example in exampleSite. We don't need any more functionality to have a first working example.
  • Discuss further functionality to add.

@zjedi zjedi merged commit d92da36 into zjedi:master Jul 5, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants