Skip to content

Commit

Permalink
Merge pull request #275 from ELIXIR-Belgium/pageid-list-fix
Browse files Browse the repository at this point in the history
Bugfix: do not list pages that have no `page_id` in the overview list of page IDs
  • Loading branch information
bedroesb authored Aug 22, 2024
2 parents 11ac003 + f779f60 commit 257a9e7
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 25 deletions.
4 changes: 2 additions & 2 deletions _data/sidebars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ subitems:
url: /general_page_5
- title: All trainings
url: /all_trainings
- title: Website overview
url: /website_overview
- title: List of page IDs
url: /list_page_ids
- title: 404 page not found
url: /404
hr: true
Expand Down
4 changes: 1 addition & 3 deletions _includes/pageids-overview.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{%- assign sidebar = site.data.sidebars[include.sidebar]['subitems'] -%}
{%- for sections in sidebar %}
{%- assign section = sections.title | downcase | replace: " ", "_" %}
{%- assign section_pages = site.pages | where:"type", section %}
{%- assign section_pages = site.pages | where:"type", section | where_exp: "item", "item.search_exclude != true" | where_exp: "item", "item.page_id != nil" %}
{%- unless section_pages.size == 0 %}
<h2>{{sections.title}}</h2>
<div class="table-responsive">
Expand All @@ -16,14 +16,12 @@ <h2>{{sections.title}}</h2>
</thead>
<tbody>
{%- for section_page in section_pages %}
{%- if section_page.page_id and section_page.search_exclude != true %}
<tr>
<td><a href="{{ section_page.url | relative_url }}">{{section_page.title}}</a></td>
<td>{{section_page.page_id}}</td>
<td>{{section_page.description | default: "no description"}}</td>
<td>{{section_page.url}}</td>
</tr>
{%- endif %}
{%- endfor %}
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion pages/documentation/navigation_structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ If no sidebar should be displayed, add `sidebar: false` to the frontmatter of th

## Top navigation and sidebar relationship

Top navigation titles can be used to switch between different high level sections on the website, each having their own sidebar. As described before, sidebars are defined by the `sidebar` metadata attribute in a page, so linking in the topnav YAML towards whis page is one part of the job. To make sure that all pages within that sidebar have this topnav item on active, one has to name its sidebar file in the same way as the topnav title (spaces, hyphens and underscores get ignored).
Top navigation titles can be used to switch between different high level sections on the website, each having their own sidebar. As described before, sidebars are defined by the `sidebar` metadata attribute in a page, so linking in the topnav YAML towards this page is one part of the job. To make sure that all pages within that sidebar have this topnav item on active, one has to name its sidebar file in the same way as the topnav title (spaces, hyphens and underscores get ignored).

Example: `/_data/sidebars/main_sidebar.yml` and in the `/_data/topnav.yml`:

Expand Down
2 changes: 1 addition & 1 deletion pages/documentation/page_mechanics.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ It is important to know that you can also set the these key-value pairs on multi

* `sitemap`: Let the page appear in the sitemap.xml. Default: *true*

* `no_robots`: By setting this field to true, the page will not end up in the search results of google or any other search engine.
* `no_robots`: By setting this field to true, the page will not end up in the search results of google or any other search engine. Default: *false*

* `custom_editme`: This attribute can be used to specify an alternative file when clicked on the edit-me or history button. Example: _data/news.yml

Expand Down
2 changes: 1 addition & 1 deletion pages/documentation/resource_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Each tool or resource mentioned in the text has metadata stored in the [main yam
- **url**: URL to the main page of the tool or resource, make sure to let the URL start with `https://`
- **description**: A short description of the tool or resource. Try to not use the characters `"` or `'`
- **registry**: 3 registries are supported: [Bio.tools](https://bio.tools), [FAIRsharing.org](https://fairsharing.org/), [TeSS](https://tess.elixir-europe.org/) and [EuroPMC](https://europepmc.org/). The keywords you can use respectively are: `biotools`, `fairsharing`, `fairsharing-coll`, `tess` and `europmc`, specifying the id or query with a colon. FAIRsharing collections have an ID that follows the pattern `bsg-s000XXX`. List registries under the `registry` attribute as `key: value pairs`.
- **related_pages**: List of page_ids (It is not adviced to use this in combination with the `{% raw %}{% tool "tool_id" %}{% endraw %}` snippet in the text)
- **related_pages**: List of page_ids (It is not advised to use this in combination with the `{% raw %}{% tool "tool_id" %}{% endraw %}` snippet in the text)
- **how_to_access**: This is free text feels that describes the accessibility of the tool or resource.


Expand Down
3 changes: 3 additions & 0 deletions pages/example_pages/TEMPLATE_general_page.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
title: Template example
type: example_pages
contributors: [Bert Droesbeke]
search_exclude: true
sitemap: false
no_robots: true
description: This description is used when the page is listed
page_id: gp1
affiliations: [ELIXIR Europe, BE, SE]
Expand Down
20 changes: 20 additions & 0 deletions pages/example_pages/list_page_ids.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: List of page IDs
---


You can generate an overview table listing all pages that have a `page_id` in their frontmatter, grouped per per section. Pages also need to have `search_exclude` not *true* in order to be listed. This can be useful for contributors to know what the `page_id` is of a page since this `page_id` is used to list related pages of a page or tagging national tools.

Use following snippet

```
{% raw %}
{% include pageids-overview.html sidebar="main"%}
{% endraw %}
```

Which will render into:

{% include pageids-overview.html sidebar="main" %}


17 changes: 0 additions & 17 deletions pages/example_pages/website_overview.md

This file was deleted.

0 comments on commit 257a9e7

Please sign in to comment.