Skip to content

Commit a56a7f6

Browse files
committed
Attempt to output assets using absolute url
1 parent 6a298d2 commit a56a7f6

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

.github/workflows/publish.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
fetch-depth: 1
3636

3737
- name: Setup Pages
38+
id: pages
3839
uses: actions/configure-pages@v5
3940

4041
- name: Cache JS dependencies
@@ -59,13 +60,13 @@ jobs:
5960
run: |
6061
cd portal
6162
npm ci
62-
npm run build
6363
6464
- name: Build static website
65+
env:
66+
ASSETS_URL: ${{ steps.pages.outputs.base_url }}
6567
run: |
6668
cd portal
6769
npm run build
68-
vendor/bin/jigsaw build production
6970
7071
7172
- name: Upload artifact

portal/config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use Illuminate\Support\Str;
4+
35
return [
46
'production' => false,
57
'baseUrl' => 'http://localhost:8000/',
@@ -21,4 +23,12 @@
2123
},
2224
],
2325
],
26+
27+
'absoluteUrl' => function ($page, $path) {
28+
if(Str::startsWith($path, 'http')){
29+
return $path;
30+
}
31+
32+
return rtrim($page->baseUrl, '/') . '/' . trimPath($path);
33+
},
2434
];

portal/source/_layouts/main.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<link rel="stylesheet" href="{{ vite('source/_assets/css/main.css') }}">
1111
<script defer type="module" src="{{ vite('source/_assets/js/main.js') }}"></script>
1212

13-
<link rel="icon" type="image/svg+xml" href="/assets/favicon.svg">
13+
<link rel="icon" type="image/svg+xml" href="{{ $page->absoluteUrl('/assets/favicon.svg') }}">
1414

1515

1616
<meta property="og:title" content="{{ $page->title }}">
@@ -20,10 +20,10 @@
2020
<link rel="canonical" href="{{ $page->getUrl() }}">
2121
<meta property="og:url" content="{{ $page->getUrl() }}">
2222
<meta property="og:site_name" content="OneOffTech">
23-
<meta property="og:image" content="/assets/images/og.jpg">
23+
<meta property="og:image" content="{{ $page->absoluteUrl('/assets/images/og.jpg') }}">
2424
<meta property="og:type" content="website">
2525
<meta name="twitter:card" content="summary_large_image">
26-
<meta property="twitter:image" content="/assets/images/og.jpg">
26+
<meta property="twitter:image" content="{{ $page->absoluteUrl('/assets/images/og.jpg') }}">
2727
<meta property="twitter:title" content="{{ $page->title }}">
2828

2929

0 commit comments

Comments
 (0)