Skip to content

Commit

Permalink
(MAINT) Define Front Matter metadata for Toroidal
Browse files Browse the repository at this point in the history
This change adds the `toroidal` and `toroidal/admin` content types to
the Front Matter configuration so that site maintainers can edit the
metadata for those pages in a friendly UI.

For member pages and the admin page, this is fully functional. For the
webring index, this is limited currently by the implementation of
estruyf/vscode-front-matter#362, which introduces `where` logic for the
fields but doesn't yet support using that logic to control behavior
based on the file name, which would allow us to handle section pages
(which are always named `_index.md`) separately from member pages.

This change also updates the archetypes for Toroidal to set the
`type` to `toroidal` for the index and member pages, ensuring that
Front Matter picks up the type correctly for selecting the metadata to
display. Due to a limitation outlined in estruyf/vscode-front-matter#360
(see [this comment for more information][01]), we have to use `type` to
identify files. This has some implications for Hugo sites which don't
_directly_ impact this change.

[01]: estruyf/vscode-front-matter#360 (comment)
  • Loading branch information
michaeltlombardi committed Nov 24, 2022
1 parent be02f66 commit 00c8b86
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .frontmatter/config/taxonomy/contentTypes/toroidal-admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "toroidal/admin",
"$schema": "https://beta.frontmatter.codes/config/taxonomy.contenttypes.schema.json",
"pageBundle": false,
"fields": [
{
"title": "Content Type",
"name": "type",
"description": "Required to tell Front Matter that this is a schematize page. Setting this to anything other than 'toroidal/admin' prevents Front Matter from recognizing this content type properly.",
"type": "string",
"single": true,
"required": true,
"hidden": true,
"default": "toroidal/admin"
},
{
"title": "Output Formats",
"name": "outputs",
"description": "Specifies the content type that makes this an administration page. If this value isn’t set, the Toroidal module won’t process the page correctly. A webring without an administration page won’t work properly.",
"type": "choice",
"required": true,
"multiple": true,
"choices": [
{ "id": "html", "title": "Publish Web Page (html)" },
{ "id": "toroidal", "title": "Publish JSON API data (toroidal)" }
]
},
{
"title": "Administration Details",
"name": "AdminDetails",
"description": "This setting defines the partial to use for the 'About Member Administration' details element in a webring's administration page. For more information, see: https://platen.io/schemas/toroidal/content/admin/#admindetails",
"type": "string",
"single": true
}
]
}
80 changes: 80 additions & 0 deletions .frontmatter/config/taxonomy/contentTypes/toroidal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"name": "toroidal",
"$schema": "https://beta.frontmatter.codes/config/taxonomy.contenttypes.schema.json",
"pageBundle": false,
"fields": [
{
"title": "Member Display Name",
"name": "name",
"description": "Specifies the display name of the member site. This value is used in the member list, the title for the member's iframe page, and the webring's administration page.",
"type": "string",
"single": true,
"required": true
},
{
"title": "Member Description",
"name": "description",
"description": "Specifies a short description of the member site. This value is used as the synopsis for the member in the member list and in the the metadata for the member's iframe page.",
"type": "string",
"required": true
},
{
"title": "Weight",
"name": "weight",
"description": "Specifies the member's position in the webring. This value is used to determine the order to display the member in the member list and the webring's administration page. It's also used to determine which members of the webring are adjacent, ensuring a deterministic and validly looping webring.",
"type": "number",
"required": true
},
{
"title": "Content Type",
"name": "type",
"description": "Required to tell Front Matter that this is a schematize page. Setting this to anything other than 'schematize' prevents Front Matter from recognizing this content type properly.",
"type": "string",
"single": true,
"required": true,
"hidden": true,
"default": "toroidal"
},
{
"title": "Member HomePage",
"name": "ToroidalHomePage",
"description": "The URL to the webring member's home page. If this value isn't specified for a member, Hugo raises an error.",
"type": "string",
"single": true,
"required": true
},
{
"title": "Display Random Member",
"name": "ToroidalRandomMemberLink",
"description": "Specifies whether the navigation for a member should include a link to a random member of the webring. This setting can be defined at the site, webring, and member level, with the webring overriding the site and the member overriding both.",
"type": "boolean"
},
{
"title": "Additional Class",
"name": "ToroidalClass",
"description": "Specifies one or more classes to append to the generated HTML for the webring. To specify multiple classes, separate each class with a space. You can use this value with the defined themes to style a webring more specifically.",
"type": "string",
"single": true
},
{
"title": "Webring Name",
"name": "ToroidalWebringName",
"description": "Specifies the name of the webring. This setting can be defined at the site, webring, and member level, with the webring overriding the site and the member overriding both. If this value isn't specified, the default name Webring is used.",
"type": "string",
"single": true
},
{
"title": "Member Name",
"name": "ToroidalMemberName",
"description": "Specifies the name of the member. This setting overrides the value used in name. Use this when you want the page name and the member name to be different.",
"type": "string",
"single": true
},
{
"title": "Hide Header",
"name": "ToroidalHideHeader",
"description": "This setting specifies whether to hide the h2 element on member pages. By default, every member page includes the webring's name as an h2 at the top of the member's navigation.",
"type": "boolean"
}
]
}
1 change: 1 addition & 0 deletions modules/toroidal/archetypes/toroidal-member.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ name: {{ replace .Name "-" " " | title }}
description: |
A short summary of the member's site
weight: 1 # Replace with desired weight.
type: toroidal
ToroidalHomePage: https://member.com # Replace with the member's actual site
---
4 changes: 2 additions & 2 deletions modules/toroidal/archetypes/toroidal-webring/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# For more information about the available options for defining a member site,
# see: http://platen.io/schemas/Toroidal/Content/Section/
title: {{ $webringName }}
type: toroidal
cascade:
type: toroidal
ToroidalWebringName: {{ $webringName }}
---

This is boilerplate text that is never shown. Hugo requires _some_ text in the body of a file to
display it as a clickable link in the site menu. That's the only purpose of this paragraph.
display it as a clickable link in the site menu. That's the only purpose of this paragraph.
3 changes: 2 additions & 1 deletion modules/toroidal/docs/webrings/example-webring/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# For more information about the available options for defining a member site,
# see: http://platen.io/schemas/Toroidal/Content/Section/
title: Example Webring
type: toroidal
cascade:
type: toroidal
ToroidalWebringName: Example Webring
---

This is boilerplate text that is never shown. Hugo requires _some_ text in the body of a file to
display it as a clickable link in the site menu. That's the only purpose of this paragraph.
display it as a clickable link in the site menu. That's the only purpose of this paragraph.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ name: First Member
description: |
A short summary of the member's site
weight: 1 # Replace with desired weight.
type: toroidal
ToroidalHomePage: https://member.com # Replace with the member's actual site
---
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ name: Second Member
description: |
A short summary of the member's site
weight: 2 # Replace with desired weight.
type: toroidal
ToroidalHomePage: https://member.com # Replace with the member's actual site
---

0 comments on commit 00c8b86

Please sign in to comment.