Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Prepare codebase to migrate to GitHub Pages #127

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Dec 4, 2024

I've tested this on my own account in https://guysartorelli.github.io/api.silverstripe.org/

Warning

There are some caveats with the above, which are a result of the hosting being in https://guysartorelli.github.io/api.silverstripe.org/ instead of directly on https://guysartorelli.github.io/.
Crucially, once api.silverstripe.org is pointing at the GitHub Pages, these problems should all go away:

  • The css for the 404 page isn't found
  • The favicon isn't found
  • The redirections (other than the one in the main index.html which works differently) all redirect to /<something> which ends up at https://guysartorelli.github.io/<something> instead of https://guysartorelli.github.io/api.silverstripe.org/<something>
  • The version detection in the 404 javascript finds that the version starts with api.silverstripe.org instead of what comes after that

Issue

@GuySartorelli GuySartorelli mentioned this pull request Dec 4, 2024
4 tasks
@GuySartorelli GuySartorelli marked this pull request as draft December 4, 2024 05:03
@GuySartorelli GuySartorelli force-pushed the pulls/master/migrate-to-gh-pages branch 6 times, most recently from ec5dbe8 to 00ce1cb Compare December 4, 2024 21:53
dependabot bot and others added 2 commits December 5, 2024 11:19
Bumps [twig/twig](https://github.com/twigphp/Twig) from 3.12.0 to 3.14.2.
- [Changelog](https://github.com/twigphp/Twig/blob/3.x/CHANGELOG)
- [Commits](twigphp/Twig@v3.12.0...v3.14.2)

---
updated-dependencies:
- dependency-name: twig/twig
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
@GuySartorelli GuySartorelli force-pushed the pulls/master/migrate-to-gh-pages branch from 00ce1cb to 9dffad6 Compare December 4, 2024 22:19
background-image: url('https://www.silverstripe.com/themes/ssv3/img/banners/page-not-found.gif');
background-image: url('/images/page-not-found.gif');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was a 404. Nabbed the image from silverstripe.org which uses it for its 404 page too.

<title>Redirecting...</title>
<link rel="canonical" href="https://api.silverstripe.org/{{ default_version }}/index.html" />
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url={{ default_version }}/index.html" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mimics the old .htaccess redirect


const url = getRedirectUrl();
console.log(`Redirecting to ${url}`);
window.location.assign(url);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mimics the old lookup.php logic as much as possible. Most of the code here is just a straight port from the PHP code to JS.

@@ -82,6 +82,7 @@
'source_dir' => $sc['source_dir'],
'insert_todos' => $sc['insert_todos'],
'base_url' => $sc['base_url'],
'favicon' => '/favicon.ico',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did we not have this until now lol

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from the old errors/404.html page, then modified to:

  1. Use a <title> more consistent with every other page on the site
  2. Redirect to search if it looks like someone was trying to search for a class
  3. The "home" link uses the default version directly, rather than / which would then redirect to the default version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same favicon the docs site uses

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files referenced here don't exist

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files referenced here don't exist

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was testing the search functionality, which had to be ported to javascript.
Unfortunately there's no simple way to test it now without either:
a) setting up a js build chain with jest tests
b) setting up end-to-end testing e.g. behat

I'm happy to open a card to do one of those in the future, but for now I'm keen to just get this out so we can publish comms about the alpha and get moving again on CMS 6 stuff

@GuySartorelli GuySartorelli marked this pull request as ready for review December 4, 2024 22:31
@silverstripe silverstripe deleted a comment from GuySartorelli Dec 4, 2024
@emteknetnz emteknetnz merged commit a3da87e into silverstripe:master Dec 4, 2024
7 checks passed
emteknetnz added a commit to creative-commoners/api.silverstripe.org that referenced this pull request Dec 5, 2024
…ulls/master/migrate-to-gh-pages"

This reverts commit a3da87e, reversing
changes made to bfe0238.
GuySartorelli added a commit that referenced this pull request Dec 5, 2024
Revert "Merge pull request #127 from creative-commoners/pulls/master/…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants