Skip to content

Commit 042f606

Browse files
committed
https://github.com/haxtheweb/issues/issues/2285
1 parent f6d76e9 commit 042f606

31 files changed

+1649
-168
lines changed

src/boilerplate/site/ghpages.html

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<script>
5+
// attempt to correctly set the base without knowing where we're installed fully...
6+
if (document.location.pathname.indexOf('/_sites/') != -1) {
7+
document.write("<base href='" + document.location.pathname.substring(0, document.location.pathname.indexOf('/', document.location.pathname.indexOf('/_sites/') + 8)) + "/' />");
8+
}
9+
else if (document.location.pathname.indexOf('/sites/') != -1) {
10+
document.write("<base href='" + document.location.pathname.substring(0, document.location.pathname.indexOf('/', document.location.pathname.indexOf('/sites/') + 7)) + "/' />");
11+
}
12+
else if (globalThis.location.host.indexOf('github.io') != -1 && globalThis.location.pathname.split('/').length > 1) {
13+
document.write("<base href='/" + document.location.pathname.split('/')[1] + "/' />");
14+
}
15+
else {
16+
document.write("<base href='/' />");
17+
}
18+
var mangedSEO = document.querySelectorAll('[data-managed-seo]');
19+
for (var i = 0; i < mangedSEO.length; i++) {
20+
var seoTag = mangedSEO[i];
21+
seoTag.setAttribute('content', document.location.href);
22+
}
23+
</script>
24+
<script type="importmap">
25+
{
26+
"scopes": {
27+
"./custom/build/": {
28+
"@haxtheweb/": "https://cdn.hax.cloud/cdn/build/es6/node_modules/@haxtheweb/"
29+
}
30+
}
31+
}
32+
</script>
33+
<meta charset="utf-8">
34+
<link rel="preconnect" crossorigin href="https://fonts.googleapis.com">
35+
<link rel="preconnect" crossorigin href="https://cdnjs.cloudflare.com">
36+
<title>HAXcms</title>
37+
<meta name="application-name" content="HAXcms" />
38+
<meta name="apple-mobile-web-app-title" content="HAXcms" />
39+
<meta name="og:sitename" property="og:sitename" content="HAXcms" />
40+
<meta name="og:title" property="og:title" content="HAXcms" />
41+
<meta name="twitter:title" property="twitter:title" content="HAXcms" />
42+
<meta name="og:url" property="og:url" content="/" data-managed-seo />
43+
<meta name="twitter:site" property="twitter:site" content="/" data-managed-seo />
44+
<link rel="preload" href="./build.js" as="script" />
45+
<link rel="preload" href="./build-haxcms.js" as="script" />
46+
<link rel="preload" href="./wc-registry.json" as="fetch" crossorigin="anonymous" fetchpriority="high" />
47+
<link rel="preload" href="./build/es6/node_modules/@haxtheweb/dynamic-import-registry/dynamic-import-registry.js" as="script" crossorigin="anonymous" />
48+
<link rel="modulepreload" href="./build/es6/node_modules/@haxtheweb/dynamic-import-registry/dynamic-import-registry.js" />
49+
<link rel="preload" href="./build/es6/node_modules/@haxtheweb/wc-autoload/wc-autoload.js" as="script" crossorigin="anonymous" />
50+
<link rel="modulepreload" href="./build/es6/node_modules/@haxtheweb/wc-autoload/wc-autoload.js" />
51+
<link rel="preload" href="./build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/themes/haxcms-basic-theme.js" as="script" crossorigin="anonymous" />
52+
<link rel="modulepreload" href="./build/es6/node_modules/@haxtheweb/haxcms-elements/lib/core/themes/haxcms-basic-theme.js" />
53+
<link rel="preload" href="./build/es6/node_modules/@haxtheweb/haxcms-elements/lib/base.css" as="style" />
54+
<meta name="generator" content="HAXcms">
55+
<link rel="manifest" href="manifest.json">
56+
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
57+
<link rel="icon" href="assets/icon-48x48.png">
58+
<meta name="theme-color" content="">
59+
<meta name="robots" content="index, follow">
60+
<meta name="mobile-web-app-capable" content="yes">
61+
<meta name="apple-mobile-web-app-capable" content="yes">
62+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
63+
<link rel="apple-touch-icon" sizes="48x48" href="assets/icon-48x48.png">
64+
<link rel="apple-touch-icon" sizes="72x72" href="assets/icon-72x72.png">
65+
<link rel="apple-touch-icon" sizes="96x96" href="assets/icon-96x96.png">
66+
<link rel="apple-touch-icon" sizes="144x144" href="assets/icon-144x144.png">
67+
<link rel="apple-touch-icon" sizes="192x192" href="assets/icon-192x192.png">
68+
<meta name="msapplication-TileImage" content="assets/icon-144x144.png">
69+
<meta name="msapplication-TileColor" content="">
70+
<meta name="msapplication-tap-highlight" content="no">
71+
<meta name="description" content="" />
72+
<meta name="og:type" property="og:type" content="article" />
73+
<meta name="og:description" property="og:description" content="" />
74+
<meta name="og:image" property="og:image" content="" />
75+
<meta name="twitter:card" property="twitter:card" content="summary_large_image" />
76+
<meta name="twitter:description" property="twitter:description" content="" />
77+
<meta name="twitter:image" property="twitter:image" content="" />
78+
<meta rel="cc:license" href="https://creativecommons.org/licenses/by-sa/4.0/" content="License: Creative Commons: Attribution Share a like"/>
79+
80+
<!-- Service worker disabled via settings -->
81+
<style>
82+
body {
83+
margin: 0;
84+
padding: 0;
85+
min-height: 98vh;
86+
}
87+
haxcms-site-builder:not([theme-loaded]) * {
88+
margin-top: 100px;
89+
display: block;
90+
max-width: 50vw;
91+
margin-left: auto;
92+
margin-right: auto;
93+
}
94+
haxcms-site-builder[theme-loaded] .haxcms-theme-element:not(:defined) {
95+
margin-top: 100px;
96+
}
97+
haxcms-site-builder[theme-loaded] .haxcms-theme-element:not(:defined) * {
98+
max-width: 50vw;
99+
margin-left: auto;
100+
margin-right: auto;
101+
}
102+
haxcms-site-builder[theme-loaded] .haxcms-theme-element:not(:defined) *:not(:defined) {
103+
display: block;
104+
min-height: 50px;
105+
min-width: 200px;
106+
}
107+
</style>
108+
<style id="loadingstyles">
109+
haxcms-site-builder {
110+
display: block;
111+
}
112+
body {
113+
background-color: #ffffff;
114+
color: rgba(0,0,0, 0.2);
115+
}
116+
#loading {
117+
background-color: #ffffff;
118+
bottom: 0px;
119+
left: 0px;
120+
opacity: 1;
121+
position: absolute;
122+
right: 0px;
123+
top: 0px;
124+
z-index: 99999999;
125+
}
126+
#loading.loaded {
127+
animation: fade-out .1s ease-in-out;
128+
animation-fill-mode: forwards;
129+
}
130+
#loading div.messaging {
131+
color: rgba(0,0,0, 0.2);
132+
left: 0px;
133+
position: absolute;
134+
right: 0px;
135+
text-align: center;
136+
top: 25vh;
137+
}
138+
#loading div.messaging h1 {
139+
font-family: Helvetica, "Trebuchet MS", Verdana, sans-serif !important;
140+
line-height: 2;
141+
font-size: 18px !important;
142+
margin: 0;
143+
padding: 0;
144+
}
145+
146+
.progress-line,
147+
.progress-line:before {
148+
height: 8px;
149+
width: 100%;
150+
margin: auto;
151+
}
152+
.progress-line {
153+
background-color: rgba(0,0,0, 0.1);
154+
display: -webkit-flex;
155+
display: flex;
156+
width: 50vw;
157+
}
158+
.progress-line:before {
159+
background-color: #FF2222;
160+
content: '';
161+
animation: running-progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
162+
}
163+
@keyframes running-progress {
164+
0% {
165+
margin-left: 0px;
166+
margin-right: 100%;
167+
}
168+
50% {
169+
margin-left: 25%;
170+
margin-right: 0%;
171+
}
172+
100% {
173+
margin-left: 100%;
174+
margin-right: 0;
175+
}
176+
}
177+
@keyframes fade-out {
178+
0% {
179+
opacity: 1;
180+
}
181+
99% {
182+
opacity: 0;
183+
}
184+
100% {
185+
opacity: 0;
186+
}
187+
}
188+
@media (prefers-color-scheme: dark) {
189+
body {
190+
background-color: #333333;
191+
color: rgba(255,255,255, 0.2);
192+
}
193+
#loading {
194+
background-color: #333333;
195+
}
196+
#loading div.messaging {
197+
color: rgba(255,255,255, 0.2);
198+
}
199+
}
200+
</style>
201+
<script id="loadingscript">
202+
globalThis.dataLayer = globalThis.dataLayer || [];
203+
function gtag(){dataLayer.push(arguments);}
204+
gtag('js', new Date());
205+
globalThis.addEventListener('haxcms-ready', function(e) {
206+
var s = document.createElement('script');
207+
s.async = true;
208+
document.body.appendChild(s);
209+
// give the web components a second to build
210+
setTimeout(function() {
211+
document.querySelector('#loading').classList.add('loaded');
212+
setTimeout(function() {
213+
if (globalThis.HAXCMS.requestAvailability().store.getManifest()) {
214+
var gaid = globalThis.HAXCMS.requestAvailability().store.getManifest().metadata.site.settings.gaID || null;
215+
if (gaid) {
216+
gtag('config', gaid);
217+
s.src = `https://www.googletagmanager.com/gtag/js?id=${gaid}`;
218+
}
219+
}
220+
document.querySelector('#loading').parentNode.removeChild(document.querySelector('#loading'));
221+
document.querySelector('#loadingstyles').parentNode.removeChild(document.querySelector('#loadingstyles'));
222+
document.querySelector('#loadingscript').parentNode.removeChild(document.querySelector('#loadingscript'));
223+
}, 100);
224+
}, 300);
225+
});
226+
</script>
227+
</head>
228+
<body vocab="http://schema.org/" prefix="oer:http://oerschema.org cc:http://creativecommons.org/ns dc:http://purl.org/dc/terms/">
229+
<section role="alert" id="loading" aria-busy="true">
230+
<div class="messaging">
231+
<div class="progress-line"></div>
232+
<h1>Loading..</h1>
233+
</div>
234+
</section>
235+
<haxcms-site-builder id="site" file="site.json?2GQKWcJ3ni0xrL2X4_Dw_Sr9SeXqY2Sk3XblmvHVArA"></haxcms-site-builder>
236+
<script>
237+
globalThis.MicroFrontendRegistryConfig = globalThis.MicroFrontendRegistryConfig || {};
238+
globalThis.HAXCMSContext="php";globalThis.__appCDN="./";</script>
239+
<script src="./build-haxcms.js"></script>
240+
<script src="./build.js"></script>
241+
</body>
242+
</html>

src/boilerplate/site/index.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
<!DOCTYPE html>
22
<html lang="en-US">
33
<head>
4-
<script type="importmap">
5-
{
6-
"scopes": {
7-
"./custom/build/": {
8-
"@haxtheweb/": "./build/es6/node_modules/@haxtheweb/"
9-
}
10-
}
11-
}
12-
</script>
13-
<meta charset="utf-8">
14-
<link rel="preconnect" crossorigin href="https://fonts.googleapis.com">
15-
<link rel="preconnect" crossorigin href="https://cdnjs.cloudflare.com">
16-
<title>HAXcms</title>
17-
<meta name="application-name" content="HAXcms" />
18-
<meta name="apple-mobile-web-app-title" content="HAXcms" />
19-
<meta name="og:sitename" property="og:sitename" content="HAXcms" />
20-
<meta name="og:title" property="og:title" content="HAXcms" />
21-
<meta name="twitter:title" property="twitter:title" content="HAXcms" />
22-
<meta name="og:url" property="og:url" content="/" data-managed-seo />
23-
<meta name="twitter:site" property="twitter:site" content="/" data-managed-seo />
244
<script>
255
// attempt to correctly set the base without knowing where we're installed fully...
266
if (document.location.pathname.indexOf('/_sites/') != -1) {
@@ -41,6 +21,26 @@
4121
seoTag.setAttribute('content', document.location.href);
4222
}
4323
</script>
24+
<script type="importmap">
25+
{
26+
"scopes": {
27+
"./custom/build/": {
28+
"@haxtheweb/": "./build/es6/node_modules/@haxtheweb/"
29+
}
30+
}
31+
}
32+
</script>
33+
<meta charset="utf-8">
34+
<link rel="preconnect" crossorigin href="https://fonts.googleapis.com">
35+
<link rel="preconnect" crossorigin href="https://cdnjs.cloudflare.com">
36+
<title>HAXcms</title>
37+
<meta name="application-name" content="HAXcms" />
38+
<meta name="apple-mobile-web-app-title" content="HAXcms" />
39+
<meta name="og:sitename" property="og:sitename" content="HAXcms" />
40+
<meta name="og:title" property="og:title" content="HAXcms" />
41+
<meta name="twitter:title" property="twitter:title" content="HAXcms" />
42+
<meta name="og:url" property="og:url" content="/" data-managed-seo />
43+
<meta name="twitter:site" property="twitter:site" content="/" data-managed-seo />
4444
<link rel="preload" href="./build.js" as="script" />
4545
<link rel="preload" href="./build-haxcms.js" as="script" />
4646
<link rel="preload" href="./wc-registry.json" as="fetch" crossorigin="anonymous" fetchpriority="high" />

src/boilerplate/site/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<!DOCTYPE html>
1515
<html lang="<?php print $HAXSiteConfig->getLanguage(); ?>">
1616
<head>
17+
<?php print $HAXSiteConfig->getBaseTag(); ?>
1718
<script type="importmap">
1819
{
1920
"scopes": {
@@ -23,7 +24,6 @@
2324
}
2425
}
2526
</script>
26-
<?php print $HAXSiteConfig->getBaseTag(); ?>
2727
<?php print $HAXSiteConfig->getSiteMetadata($HAXSiteConfig->page); ?>
2828
<?php print $HAXSiteConfig->getServiceWorkerScript(null, FALSE, $HAXSiteConfig->getServiceWorkerStatus()); ?>
2929
<style>

src/boilerplate/site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"scripts": {
1515
"start": "npm run dev",
16-
"ghpages:build": "rm assets/babel* && rm build && rm wc-registry.json",
16+
"ghpages:build": "rm index.html && mv ghpages.html index.html && rm assets/babel* && rm build && rm wc-registry.json",
1717
"dev": "npx @haxtheweb/haxcms-nodejs",
1818
"dev-theme": "cd custom && npm start"
1919
}

src/coreConfig/themes.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
"name": "Clean Portfolio theme",
1818
"thumbnail": "build/es6/node_modules/@haxtheweb/app-hax/lib/assets/images/PartyStyle.svg"
1919
},
20+
"journey-theme": {
21+
"element": "journey-theme",
22+
"path": "@haxtheweb/journey-theme/journey-theme.js",
23+
"name": "Journey theme",
24+
"thumbnail": "build/es6/node_modules/@haxtheweb/app-hax/lib/assets/images/PartyStyle.svg"
25+
},
2026
"learn-two-theme": {
2127
"element": "learn-two-theme",
2228
"path": "@haxtheweb/learn-two-theme/learn-two-theme.js",

src/lib/HAXCMS.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ class HAXCMSSite
388388
'buildhaxcms' : 'build-haxcms.js',
389389
'outdated' : 'assets/upgrade-browser.html',
390390
'index' : 'index.html', // static published fallback
391+
'ghpages' : 'ghpages.html', // github pages publishing for custom theme work
391392
'404' : '404.html', // github / static published redirect appropriately
392393
// seo / performance
393394
'push' : 'push-manifest.json',
@@ -719,6 +720,7 @@ class HAXCMSSite
719720
break;
720721
}
721722
this.manifest.addItem(page);
723+
this.manifest.metadata.site.updated = Math.floor(Date.now() / 1000);
722724
await this.manifest.save();
723725
// support direct HTML setting
724726
if (template == 'html') {

0 commit comments

Comments
 (0)