Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,10 @@ export default defineConfig({
// abap2UI5 site (CONVENTION.md in abap2UI5/abap2UI5.github.io). Another
// deployment on the same origin, hence target _self (check:cross-site).
logoLink: { link: "https://abap2ui5.github.io/", target: "_self" },
// The family's foot (CONVENTION.md section 5 in abap2UI5/abap2UI5.github.io):
// the same line as the home page, the licence and About, nothing more.
footer: {
message: `
<a href="/docs/resources/license">License</a> |
<a href="/docs/resources/support#contact">Contact</a>`,
copyright: `Copyright © 2023-${new Date().getFullYear()} abap2UI5`,
message: `<a href="https://github.com/abap2UI5/abap2UI5/blob/main/LICENSE" target="_blank" rel="noopener">MIT licensed</a> · <a href="https://abap2ui5.github.io/about/" target="_self">About</a>`,
},
editLink: {
pattern:
Expand Down
6 changes: 5 additions & 1 deletion scripts/lib/cross-site.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ export const RETIRED = new Map([
/** The family's home page, abap2UI5/abap2UI5.github.io: the origin's root,
* and only the root - a prefix of everything, so it is matched exactly. */
export const HOME = '/';
/** The home deployment's other pages, each matched exactly for the same
* reason: About, which the family's foot links from every page
* (CONVENTION.md section 5 over there). */
export const HOME_PAGES = ['/about/'];

export function unreachable(pathname) {
if (pathname === HOME) return null;
if (pathname === HOME || HOME_PAGES.includes(pathname)) return null;
for (const at of NEIGHBOURS) if (pathname.startsWith(at)) return null;
for (const [at, instead] of RETIRED) {
if (pathname === at || pathname.startsWith(at)) return `retired — use ${instead}`;
Expand Down
2 changes: 2 additions & 0 deletions test/cross-site.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ test('a cross-site link that points at a deployment which is gone is named as go
link that dies fails the build; a link to the site next door just quietly
stops being true. */
assert.equal(unreachable('/'), null, 'the home page');
assert.equal(unreachable('/about/'), null, 'the home page\'s About, which the foot links');
assert.match(unreachable('/about/team/'), /not a deployment/, 'matched exactly, not as a prefix');
assert.match(unreachable('/nowhere/'), /not a deployment/);
assert.equal(unreachable('/playground/'), null);
assert.equal(unreachable('/playground/samples/'), null);
Expand Down
Loading