Hey, Everyone, I am working on this website, which is a 3-in-1 site. Basically, the client was looking for a site that he could use for all three of his business or whatever.
So first is for his medical center, 2nd is a Hijama site, and the third is basically donations for a Masjid that he is building. So about an estimate of 18 pages. he wanted to use a single domain for all those. So I thought why not use Hugo It would be fast n ez
So hereβs what I am doing.
content/
βββ pages/
β βββ main/
β β βββ home/
β β β βββ _index.md
β β βββ services/
β β β βββ _index.md
β β βββ team/
β β β βββ _index.md
β β βββ about/
β β β βββ _index.md
β β βββ contact/
β β β βββ _index.md
β βββ mmc/
β β βββ home/
β β β βββ _index.md
β β βββ services/
β β β βββ _index.md
β β βββ team/
β β β βββ _index.md
β β βββ about/
β β β βββ _index.md
β β βββ contact/
β β β βββ _index.md
β βββ rjis/
β β βββ home/
β β β βββ _index.md
β β βββ services/
β β β βββ _index.md
β β βββ team/
β β β βββ _index.md
β β βββ about/
β β β βββ _index.md
β β βββ contact/
β β β βββ _index.md
and the same structure in layout pages/
instead of content/
and with list.html
& single.html
instead of _index.md
obviously there are more pages but this is just to simplify things.
Now the first issue I faced with this structure is the nav stopped working for some reason. I works fine if you put the site dirs outside of pages/
and content/
Hereβs what my nav looks like
baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'Laser Experts'
# Laser Expert Main Menu
[menu]
[[menu.lasermenu]]
identifier = "home-laser"
name = "Home"
pageref = "/pages/main/home/"
weight = 1
[[menu.lasermenu]]
identifier = "services-laser"
name = "Services"
pageref = "/pages/main/services/"
weight = 2
[[menu.lasermenu]]
identifier = "gallery-laser"
name = "Gallery"
pageref = "/pages/main/gallery/"
weight = 3
[[menu.lasermenu]]
identifier = "team-laser"
name = "Our Team"
pageref = "/pages/main/team/"
weight = 4
[[menu.lasermenu]]
identifier = "about-laser"
name = "About Us"
pageref = "/pages/main/about/"
weight = 5
[[menu.lasermenu]]
identifier = "contact-laser"
name = "Contact Us"
pageref = "/pages/main/contact/"
weight = 6
[[menu.droplaser]]
identifier = "pages"
name = "Links"
pageref = "#"
weight = 7
[[menu.droplaser]]
identifier = "home-mmc"
name = "Madina Medical Centre"
pageref = "/pages/mmc/home/"
parent = "pages"
weight = 8
[[menu.droplaser]]
identifier = "home-rjis"
name = "Riaz-ul-Jannat"
pageref = "/pages/rjis/home/"
parent = "pages"
weight = 9
# MMC Site Menu
[[menu.mmcmenu]]
identifier = "home-mmc"
name = "Home"
pageref = "/pages/mmc/home/"
weight = 1
[[menu.mmcmenu]]
identifier = "facilities-mmc"
name = "Facilities"
pageref = "/pages/mmc/facilities/"
weight = 2
[[menu.mmcmenu]]
identifier = "hair-mmc"
name = "Hair Transplant"
pageref = "/pages/mmc/hair/"
weight = 3
[[menu.mmcmenu]]
identifier = "liposcutions-mmc"
name = "Liposcutions"
pageref = "/pages/mmc/liposcutions/"
weight = 4
[[menu.mmcmenu]]
identifier = "clinics-mmc"
name = "OPD Clinics"
pageref = "/pages/mmc/clinics/"
weight = 5
[[menu.mmcmenu]]
identifier = "about-mmc"
name = "About Us"
pageref = "/pages/mmc/about/"
weight = 6
[[menu.mmcmenu]]
identifier = "contact-mmc"
name = "Contact Us"
pageref = "/pages/mmc/contact/"
weight = 7
[[menu.dropmmc]]
identifier = "pages"
name = "Links"
pageref = "#"
weight = 8
[[menu.dropmmc]]
identifier = "home-laser"
name = "Laser Experts"
pageref = "/pages/main/home/"
parent = "pages"
weight = 9
[[menu.dropmmc]]
identifier = "home-rjis"
name = "Riaz-ul-Jannat"
pageref = "/pages/rjis/home/"
parent = "pages"
weight = 10
# Riaz-ul-Jannah Site Menu
[[menu.rjismenu]]
identifier = "home-rjis"
name = "Home"
pageref = "/pages/rjis/home/"
weight = 1
[[menu.rjismenu]]
identifier = "about-rjis"
name = "About Us"
pageref = "/pages/rjis/about/"
weight = 2
[[menu.rjismenu]]
identifier = "donations-rjis"
name = "Donations"
pageref = "/pages/rjis/donations/"
weight = 3
[[menu.rjismenu]]
identifier = "team-rjis"
name = "Our Team"
pageref = "/pages/rjis/team/"
weight = 4
[[menu.rjismenu]]
identifier = "about-rjis"
name = "About Us"
pageref = "/pages/rjis/about/"
weight = 5
[[menu.rjismenu]]
identifier = "contact-rjis"
name = "Contact Us"
pageref = "/pages/rjis/contact/"
weight = 6
[[menu.droprjis]]
identifier = "pages"
name = "Links"
pageref = "#"
weight = 7
[[menu.droprjis]]
identifier = "home-laser"
name = "Laser Experts"
pageref = "/pages/main/home/"
parent = "pages"
weight = 8
[[menu.droprjis]]
identifier = "mmc"
name = "Madina Medical Centre"
pageref = "/pages/mmc/home/"
parent = "pages"
weight = 9
and this is code I am using to fetch the nav
<div id="irtfd" class="gjs-grid-column">
{{ if eq .Section "mmc" }}
{{ partial "common/menu/mmc.html" . }}
{{ else if eq .Section "rjis" }}
{{ partial "common/menu/rjis.html" . }}
{{ else }}
{{ partial "common/menu/laser.html" . }}
{{ end }}
</div>
</div>
</div>
<div id="id7x" class="gjs-grid-column">
<div class="dropdown">
{{ if eq .Section "mmc" }}
{{ partial "common/dropdown/mmc.html" . }}
{{ else if eq .Section "rjis" }}
{{ partial "common/dropdown/rjis.html" . }}
{{ else }}
{{ partial "common/dropdown/laser.html" . }}
{{ end }}
</div>
Code for the partial menus
laser.html
{{ $currentPage := . }}
{{ range .Site.Menus.lasermenu }}
<a href="{{ .URL }}" class="gjs-link ms-2">{{ .Name }}</a>
{{ else }}
<a href="{{ .URL }}" class="gjs-link ms-2">{{ .Name }}</a>
{{ end }}
mmc.html
{{ $currentPage := . }}
{{ range .Site.Menus.mmcmenu }}
<a href="{{ .URL }}" class="gjs-link ms-3">{{ .Name }}</a>
{{ else }}
<a href="{{ .URL }}" class="gjs-link ms-3">{{ .Name }}</a>
{{ end }}
rjis.html
{{ $currentPage := . }}
{{ range .Site.Menus.rjismenu }}
<a href="{{ .URL }}" class="gjs-link ms-2">{{ .Name }}</a>
{{ else }}
<a href="{{ .URL }}" class="gjs-link ms-2">{{ .Name }}</a>
{{ end }}
The 2nd issue I am facing is just like the nav if the list.html
for letβs say main/
isnβt in the root of main
It doesnβt anything content, but If I put in the root all pages start showing that content instead of the content form their root.
Do I need to do something like this maybe idk help me out please
content/
βββ pages/
β βββ main-home/
β β βββ _index.md
β βββ main-about/
β β βββ _index.md
β βββ mmc-home/
β β βββ _index.md
β βββ mmc-about/
β β βββ _index.md
this is what the _index.md
files look like
---
title: Home | Laser Experts
type: home-laser
url: /main/
---
Okay so I managed to fix the menu you can see here what I did
This now leaves the content not showing up⦠btw I also moved all the dirs to pages
you can also see that in the commit.