[SOLVED] How to present downloadable Files on the home page?


#1

I want to give some downloadable files directly from the home page. .

In other places I can use a leaf bundle with some resources metadata in the ‘index.md’ and a partial to show the files from a subdirectory as describe in the documentation on page bundles

If I rename the ‘_index.md’ file in /content to ‘index.md’ I only see this page , no menu entries , everythingh seems broken, but I see the ressources in the subdirectory as I want.

https://github.com/kaushalmodi/hugo-bare-min-theme is my friend here .

Do I undersatand correctly that I have to move my downladable file in the content dir directly ? And of course write a different partial to show the file list ?


#2

Can you give us a concrete example of what resources you’re trying to link?

At first glance this should work, with the right code in your index.html template.


#3

Welcome to the community!


#4

Hope this helps


#5

Directory structure is like this

content

  • index.md # the home page
    ±–download # these files should be easyly downloaadable
    ±-cv.doc
    ±- profil.doc
    ±- oracle
    + index.md
    ±-download
    | ±- some pdf files
  • another.md
  • something.md

At the moment I have no index.html at all

front matter of content(index.md is

resources:
- src: 'download/Profil.doc'
  title: Freelancer-Profil auf Deutsch
- src: 'download/CV.doc'
  title: CV in english 
  params:
    icon: word
...

I use a shortcode named download which looks like this

<ul>
	ccc
	{{ range  $.Page.Resources.Match "download/*.*" }}
	<li>
		<a target="_blank" href="{{ .Permalink }}">
			<i class="far fa-file-{{ .Params.icon }}"></i> {{ .Title }}
		</a>
	</li>
	{{ end }}
</ul>

#6

Thank you !


#7

And this shortcode does not work from your content/_index.md, correct?


#8

No, it does indeed work and thats the strange thing. When I make the home page to a leaf bundle (by using an index.md instead of _index.md) see the home page, the ressources and the download link, but no menus at all. I know that this is not the way to do it, but I was surprised by this result.

Sorry if I was confusing.

In the meantime i rebuilt the site and made the home page to a proper section bundle.

 content
 │   CV.doc
 │   Profil.doc
 │   _index.md
 ├───categories
 │   └───technote
 │           _index.md
 ├───datenschutz
 │       index.md
 ├───impressum
 │       index.md
 ├───oracle_scheduler
 │   │   index.md
 │   └───download
 │           a.pdf
 │           another.pdf
 └───technotes
         xxxx.md
         yyyy.md

I created a modified shortcode for this case . The whole thing works works mostly as I want .

The one exception is that the oracle_scheduler/index.md shows no content at all.


#9

This is because

oracle_scheduler/index.md

needs to be

oracle_scheduler/_index.md

#10

@zwbetz

Isn’t the content in oracle_scheduler a classical leaf bundle ? So it should be ‘index.md
Interestingly when I gererate the site (hugo and not hugo serve) the page gets generated.

UPDATE:

I used –disableFastRender and the page is shown with the file name index.md


#11

You’re correct. Mistake on my part.