[SOLVED] Extra page with information from all content md files (metadata)

I just figured out why the table is empty.

.GetPage is literally getting your list page under/project/ the parameters you need for your table are not rendered there.

You need to think of alternative ways to render this table under /meta/.

You cannot use range on a regular page.

You were able to render the table on your index page.

So what does the above tell you?

I think that the least painless way for you to get this working would be to assign a meta taxonomy
e.g. meta= "meta" in your config.toml and assign it to the projects you need to render in this table.

So that this table will be available under /meta/

Then either create a partial with the contents of your project-card-status.html or just place its contents on the meta taxonomy template.

You should be able to get this working with a simple range function in this taxonomy template.

Of course someone else in the forum might have a different solution for your situation.

My brain gets confused whenever I read the word “taxonomy” in relation to websites :-/
(It’s like a mix of taxes and economy, which has no relation whatsoever with websites…)

This is perhaps the problem I mentioned earlier…

Do I understand correctly that if I put meta=“meta” in config.toml and then put “meta” as a tag in each project file, I will be able to access the page variables from their frontmatter in /meta/?

You cannot use range on a regular page.
You were able to render the table on your index page.
So what does the above tell you?

This tells me that the scope of .Data.Pages is only valid at toplevel layouts/index.html
And that the $ to reference the top of the tree (or root of the tree) doesn’t apply to .Data, only to .Site

Or should it be range $.Site.Data.Pages?
(that doesn’t work, though…)

LOL! No it’s nothing like that. Actually it’s a borrowed term from biology. Taxonomy - Wikipedia

Node Pages in Hugo terminology. An index.html for a section or a taxonomy.

Anyway as I said above in config.toml you assign a meta taxonomy like this:
meta= "meta"
And then you copy this to the front matter of every project you need. A taxonomy can be called anything in Hugo. The taxonomy name becomes the URL slug under which the taxonomy list page is available. In this case it will be available under /meta/

The template to render this table should be located under /layouts/taxonomy/meta.html

As I said before either make a partial of project-card-status.html or just place its contents in this template (since you can only use .Render on a regular page you cannot use your table template in its existing form).

And finally enclose the above within a simple range function so that you can render your table.

Also you should remove whatever template you have for /meta/ as well as the .md under /content/

OK, I think I understand what you mean.

I’ll see how far this idea takes me…

One last thing (I forgot to mention) just in case you have never specified a taxonomy before in your config. It’s done like this:

[taxonomies]
meta = "meta"

@pooh22 Before doing this try using .Render like you did on your homepage before.

According to the Docs Render | Hugo

This function is only available when applied to a single piece of content within a list context.

Your mention of this error above kind of confused me.

So keep your project-card-status.html as is when you first try to render the table on your taxonomy list page. If you encounter the error then include the table template contents either in a partial or straight in the taxonomy template.

I’ve added all the meta=“meta” stuff to the frontmatter and added meta=“meta” to the taxonomies in config.toml

I’ve moved and modified the original completeness/single.html to taxonomy/meta.html
and the main thing there is:

{{ range .Site.Taxonomies.meta.Pages }}
   <!-- tables lines for each project -->
   {{ .Render "project-card-status" }}  
{{ end }}

I get the following warning:

WARN 2017/08/04 16:11:41 [en] Unable to locate layout for "taxonomyTerm": [taxonomy/meta.terms.en.html.html taxonomy/meta.terms.html.html taxonomy/meta.terms.en.html taxonomy/meta.terms.html _default/terms.en.html.html _default/terms.html.html _default/terms.en.html _default/terms.html indexes/indexes.en.html.html indexes/indexes.html.html indexes/indexes.en.html indexes/indexes.html theme/taxonomy/meta.terms.en.html.html theme/taxonomy/meta.terms.html.html theme/taxonomy/meta.terms.en.html theme/taxonomy/meta.terms.html theme/_default/terms.en.html.html theme/_default/terms.html.html theme/_default/terms.en.html theme/_default/terms.html theme/indexes/indexes.en.html.html theme/indexes/indexes.html.html theme/indexes/indexes.en.html theme/indexes/indexes.html]

And no table…

First of all download and replace your content files under/content/project/ with this archive

I made mistake before that I rectified for you.
With TOML frontmatter the taxonomies have this syntax:
meta = ["meta"]

Sorry for that. But anyway when you replace these files with what I am sending you you will see that Hugo Server will not throw any errors.

BUT

The table is still empty. I am looking at it right now. BTW I re-downloaded your repo with your latest commit.

I don’t have dropbox, but I can easily fix it with sed…

btw, still getting problems:

Started building sites ...
INFO 2017/08/04 16:46:58 found taxonomies: map[string]string{"meta":"meta"}
WARN 2017/08/04 16:46:58 [en] Unable to locate layout for "taxonomyTerm": [taxonomy/meta.terms.en.html.html taxonomy/meta.terms.html.html taxonomy/meta.terms.en.html taxonomy/meta.terms.html _default/terms.en.html.html _default/terms.html.html _default/terms.en.html _default/terms.html indexes/indexes.en.html.html indexes/indexes.html.html indexes/indexes.en.html indexes/indexes.html theme/taxonomy/meta.terms.en.html.html theme/taxonomy/meta.terms.html.html theme/taxonomy/meta.terms.en.html theme/taxonomy/meta.terms.html theme/_default/terms.en.html.html theme/_default/terms.html.html theme/_default/terms.en.html theme/_default/terms.html theme/indexes/indexes.en.html.html theme/indexes/indexes.html.html theme/indexes/indexes.en.html theme/indexes/indexes.html]

Which Hugo version are you using? I’m on the latest.

Hugo Static Site Generator v0.25.1 linux/amd64 BuildDate: 2017-07-10T08:58:07+02:00

I guess the problem must be somewhere in the meta.html template:

 {{ range .Site.Taxonomies.meta.Pages }}
   <!-- tables lines for each project -->
   {{ .Render "project-card-status" }}
 {{ end }}

Is the range expression valid?

And can the template project-card-status be found by hugo?

On my home-ground (bash perl) I could intuitively check this, but with Hugo I’m still lacking a feel for it…

Simply change the range function to:

{{ range .Site.Taxonomies.meta.meta }}

And the table will be rendered under /meta/meta/

EDIT
You may change the taxonomy name as you see fit. I admit that /meta/meta/ looks a bit weird.

wow thanks!

I guess the url is a bit ugly now, but I’m sure that can be fixed later by some more magic. And it’s not that important anyway, as this is mainly for the site sponsors to check who to nag about supplying more meta-data :wink:

I’m :smile: happy!

Cheers and have a nice weekend!

To prettify the URL do the following.

Once again create /content/meta.md
It’s contents should be what you originally had.
Then under /layouts/completeness/single.html
Place the following

{{ partial "header-nohome.html" . }}
 <div class="etalage-header">
	<h1>Free and Open Source Educational Software Projects</h1>

</div>

<div class="etalage-body">
	<p>
	Overview of all important fields for each project. If the field has a value it is shown with an icon in the table below
	</p>
</div>
<div class="hugo-blog__list mdl-grid">
	<table border=1 bgcolor="#cccccc">
		<tr>
			<th>project</th>
			<th>demosite</th>
			<th>repository</th>
			<th>website</th>
			<th>downloadlink</th>
			<th>project contact</th>
			<th>author website</th>
			<th>author e-mail</th>
		</tr>
    {{ range ($.Site.GetPage "taxonomy" "meta" "meta").Pages }}
      <!-- tables lines for each project -->
       {{ .Render "project-card-status" }}  
    {{ end }}
	</table>
</div>

{{ partial "footer.html" . }}

The key to achieve this is the range function used with a nested .GetPage function to fetch the taxonomy list page from /meta/meta

{{ range ($.Site.GetPage "taxonomy" "meta" "meta").Pages }}

Now your table is accessible under /meta/

Of course you will need to fix your Hugo menu and hide the automatic link to /meta/meta/

Enjoy!

Even better solution.

Revert your repo to what you had at the beginning of our discussion. No meta taxonomy in your config and in your posts.

Only /content/meta.md and /layouts/completeness/single.html

In /layouts/completeness/single.html simply change the range function to this.

{{ range ($.Site.GetPage "section" "project").Pages }}
{{ .Render "project-card-status" }}
{{ end }}

Turns out that the previous version of .GetPage I used to fetch the project section was incorrect. And .GetPage appears to fetch front matter parameters from the posts section.

Now your table will be rendered under /meta/

Guess, we’re all learning we go! And this solution is much more terse. And I love it!

That last addtition makes it exactly the answer I was hoping for :smile:
thanks a lot!