Skip to content

Commit

Permalink
Facilities for harmonizing footers across TEv2 sites
Browse files Browse the repository at this point in the history
Signed-off-by: Rieks <RieksJ@users.noreply.github.com>
  • Loading branch information
RieksJ committed Aug 14, 2023
1 parent aabd6e6 commit f52db34
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 56 deletions.
49 changes: 11 additions & 38 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const path = require('path');
const manuals = require('./footer-links/manuals.json');
const specifications = require('./footer-links/specifications.json');
const repositories = require('./footer-links/repositories.json');
const copyright = require('./footer-links/copyright.json');

module.exports = {
title: 'TNO Terminology Design',
tagline: 'Toolbox Specifications and Design Methods',
tagline: 'TEv2 Toolbox Specifications and Manuals',
url: 'https://tno-terminology-design.github.io',
baseUrl: '/tev2-specifications/',
favicon: 'images/logos/logo-tno-terminology-design.ico',
Expand All @@ -25,51 +30,19 @@ module.exports = {
title: 'Home',
logo: { src: 'images/logos/tev2-new-babylon-medium.png', },
items: [
{ to: 'docs/tev2-overview', label: 'TEv2 Overview', position: 'left'},
{ to: 'docs/tev2-overview', label: 'TEv2 Overview', position: 'left'},
{ href: 'https://github.com/tno-terminology-design/tev2-specifications', label: 'Github', position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'TEv2 User Manuals',
items: [
{ label: 'Curators', to: 'docs/manuals/curator' },
{ label: 'Contributors', to: 'docs/manuals/contributor' },
{ label: 'Authors', to: 'docs/manuals/author' },
// { label: 'Github', href: 'https://github.com/tno-terminology-design/tev2-specifications/tree/master/docs/terms' },
],
},
{
title: 'TEv2 Specifications',
items: [
{ label: 'Files', to: 'docs/tev2-spec-files' },
{ label: 'Syntaxes', to: 'docs/tev2-syntax' },
{ label: 'Toolbox', to: 'docs/tev2-toolbox' },
{ label: 'Github', href: 'https://github.com/tno-terminology-design/tev2-specifications/tree/master/docs/terms' },
],
},
{
title: 'Toolbox Repositories',
items: [
{ label: 'MRGT', href: 'https://github.com/trustoverip/ctwg-toolkit-mrg' },
{ label: 'TRRT', href: 'https://github.com/tno-terminology-design/trrt' },
],
},
{ title: manuals.title, items: manuals.items },
{ title: specifications.title, items: specifications.items, },
{ title: repositories.title, items: repositories.items },
],
copyright: `<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
<span property="dct:title">The TNO Terminology Design texts in this website</span> are licensed under
<a href="http://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">
CC BY-SA 4.0
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1">
</a>.&nbsp&nbsp(Copyright © 2022-${new Date().getFullYear()} by <span property="cc:attributionName">TNO</span>).</p>`
copyright: copyright.text.replace("[20XX-20YY]",`2022-${new Date().getFullYear()}`)
},
prism: {
additionalLanguages: ['handlebars', 'regex', 'bash'],
Expand Down
35 changes: 35 additions & 0 deletions footer-links/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
The .json files in this directory are meant to be used to create a consistent layout across the documentation sites of the various tools, methods, specifications, etc.

The way to achieve this in a particular repo is as follows.

1. Create a copy of the directory `https://github.com/tno-terminology-design/tev2-specifications/tree/main/footer-links` in the directory in your repo that contains `docusaurus.config.js`.

2. Edit `docusaurus.config.js` and make sure the following lines are at the beginning of that file:

~~~ json
const manuals = require('./footer-links/manuals.json');
const specifications = require('./footer-links/specifications.json');
const repositories = require('./footer-links/repositories.json');
const copyright = require('./footer-links/copyright.json');
~~~

3 Edit the `footer` section in `docusaurus.config.js`, adjusting its `links` field and `copyright` field so that they read (of course, if you don't want any of the `links` items, just leave them out; also, you can add your own items):

~~~ json
footer: {
...
links: [
{ title: manuals.title, items: manuals.items },
{ title: specifications.title, items: specifications.items, },
{ title: repositories.title, items: repositories.items },
],
...
copyright: copyright.text.replace("[20XX-20YY]",`2022-${new Date().getFullYear()}`)
...
},
~~~

4. Make sure to regularly update the contents of the `footer-links`-directory that you have created, which you can do in a github action (or similar) when you deploy your site. Alternatively, you can do that 'manually' while updating your repository, by executing either `update.ps1` in PowerShell or `update.sh` in Bash.

At this moment, these scripts have not been tested and therefor may not (yet) work.
Please create an issue or pull request specifying problems you encounter and solutions you found.
3 changes: 3 additions & 0 deletions footer-links/copyright.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"text": "<p xmlns:cc='http://creativecommons.org/ns#' xmlns:dct='http://purl.org/dc/terms/'>\n<span property='dct:title'>The texts in this website</span> are licensed under\n<a href='http://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1' target='_blank' rel='license noopener noreferrer' style='display:inline-block;'>\nCC BY-SA 4.0\n<img style='height:22px!important;margin-left:3px;vertical-align:text-bottom;' src='https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1'>\n<img style='height:22px!important;margin-left:3px;vertical-align:text-bottom;' src='https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1'>\n<img style='height:22px!important;margin-left:3px;vertical-align:text-bottom;' src='https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1'>\n</a>.&nbsp;&nbsp;Copyright © [20XX-20YY] by <span property='cc:attributionName'>TNO.</span>"
}
7 changes: 7 additions & 0 deletions footer-links/manuals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ "title": "TEv2 Manuals",
"items": [
{ "label": "Curators", "href": "https://tno-terminology-design.github.io/tev2-specifications/docs/manuals/curator/curator-overview" },
{ "label": "Contributors", "href": "https://tno-terminology-design.github.io/tev2-specifications/docs/manuals/contributor/contributor-overview" },
{ "label": "Authors", "href": "https://tno-terminology-design.github.io/tev2-specifications/docs/manuals/author/author-overview" }
]
}
7 changes: 7 additions & 0 deletions footer-links/repositories.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ "title": "TEv2 Tool Repo's",
"items": [
{ "label": "MRGT", "href": "https://github.com/trustoverip/ctwg-toolkit-mrg" },
{ "label": "MRG Importer", "href": "https://github.com/tno-terminology-design/mrg-import" },
{ "label": "TRRT", "href": "https://github.com/tno-terminology-design/trrt" }
]
}
7 changes: 7 additions & 0 deletions footer-links/specifications.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ "title": "TEv2 Specifications",
"items": [
{ "label": "Files", "href": "https://tno-terminology-design.github.io/tev2-specifications/docs/tev2-spec-files" },
{ "label": "Syntaxes", "href": "https://tno-terminology-design.github.io/tev2-specifications/docs/tev2-syntax" },
{ "label": "Toolbox", "href": "https://tno-terminology-design.github.io/tev2-specifications/docs/tev2-toolbox" }
]
}
17 changes: 17 additions & 0 deletions footer-links/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Define the necessary variables
$USER = "tno-terminology-design"
$REPO = "tev2-specifications"
$BRANCH = "main"
$DIR = "footer-links"

# Download the ZIP of the branch
Invoke-WebRequest -Uri "https://github.com/$USER/$REPO/archive/$BRANCH.zip" -OutFile "$BRANCH.zip"

# Extract the specific directory's contents directly to the current location
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory("$BRANCH.zip", "$BRANCH-temp")
Copy-Item -Path "./$BRANCH-temp/$REPO-$BRANCH/$DIR/*" -Destination "./" -Recurse -Force

# Cleanup
Remove-Item -Recurse -Force "./$BRANCH-temp"
Remove-Item "$BRANCH.zip"
15 changes: 15 additions & 0 deletions footer-links/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

USER = "tno-terminology-design"
REPO = "tev2-specifications"
BRANCH = "main"
DIR = "footer-links"

# Download the ZIP of the branch
wget "https://github.com/$USER/$REPO/archive/$BRANCH.zip"

# Extract the specific directory's contents directly to the current location
unzip -j "$BRANCH.zip" "$REPO-$BRANCH/$DIR/*" -d "./"

# Cleanup
rm -rf "$REPO-$BRANCH" "$BRANCH.zip"
32 changes: 14 additions & 18 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,30 @@ const sidebars = {
]
},
{ type: 'category',
label: 'Roles',
link: {type: 'doc', id: 'tev2-roles'},
label: 'Manuals',
link: {type: 'doc', id: 'manuals/man-overview'},
items:
[ { type: 'category',
label: 'Contributors',
link: {type: 'doc', id: 'manuals/contributor'},
items:
[ 'manuals/contributors-wiki',
, 'manuals/contributors-repo',
, 'manuals/contributors-LaTeX',
],
label: 'Authors',
link: {type: 'doc', id: 'manuals/author/author-overview'},
items: [ { type: 'autogenerated', dirName: 'manuals/author' } ]
},
{ type: 'category',
label: 'Curators',
link: {type: 'doc', id: 'manuals/curator'},
items:
[ 'manuals/tev2-installation',
'spec-tools/terminology-construction',
],
label: 'Curators',
link: {type: 'doc', id: 'manuals/curator/curator-overview'},
items: [ { type: 'autogenerated', dirName: 'manuals/curator' } ]
},
{ type: 'category',
label: 'Contributors',
link: {type: 'doc', id: 'manuals/contributor/contributor-overview'},
items: [ { type: 'autogenerated', dirName: 'manuals/contributor' } ]
},
{ type: 'doc', id: 'manuals/author'},
],
},
{ type: 'category',
label: 'Files (Structure, Specs)',
link: {type: 'doc', id: 'tev2-spec-files'},
items:
[ { type: 'autogenerated', dirName: 'spec-files' } ]
items: [ { type: 'autogenerated', dirName: 'spec-files' } ]
},
{ type: 'category',
label: 'Syntax (Specs)',
Expand Down

0 comments on commit f52db34

Please sign in to comment.