Skip to content

Static site export with relative links#440

Draft
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-static-site-export-relatively
Draft

Static site export with relative links#440
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-static-site-export-relatively

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 26, 2026

Static site exports required a web server because Astro built with absolute paths. When both GitHub Pages and static export were enabled, the static site reused the GitHub Pages build (with a slug base path), nesting output under site/project-name/ instead of site/.

The project-client already includes astro-relative-links in its config. The missing piece was a dedicated rebuild step for the static export case.

Changes

  • src/workflows/deploy-main.yml (new): Local workflow template replacing the project-template fetch dependency. Adds a "Rebuild for static site with relative links" step that runs only when both GitHub Pages and static export are enabled — uses jq to temporarily disable publish_pages_app before rebuilding, so the static output always lands at site/index.html with relative links:
- name: Rebuild for static site with relative links
  if: ${{ env.project_publish_publish_static_site == 'true' && env.project_publish_publish_pages_app == 'true' }}
  working-directory: "./client"
  run: |
    jq '.publish.publish_pages_app = false' ./src/content/project/project.json > /tmp/project.tmp.json
    mv /tmp/project.tmp.json ./src/content/project/project.json
    npm run build
  • src/backend/projectHelpers.ts: publishSite() now imports the local workflow via Vite ?raw and compares it against the project repo's current workflow content, updating only when they differ. Removes the two-step SHA comparison against AVAnnotate/project-template.

  • src/env.d.ts: Added /// <reference types="vite/client" /> to support ?raw imports.

Scenario matrix

Config Result
Static only site/index.html with relative links (was already correct)
Pages only GitHub Pages deploy, unchanged
Both GitHub Pages deploy + separate site/index.html rebuild with relative links

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.sheetjs.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install grep -l ve alize.ts ndor/bin/grep ve pareEventsModal.-w tnet/tools/git grep -l ve es.ts (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>static site export with relative links</issue_title>
<issue_description>The existing code supports downloading a static site for a project, but that static site requires running in a webserver. We'd like the static site download to be something that is truly static -- an index.html page that links relatively to other pages in the site.

I found this discussion:
https://www.reddit.com/r/astrojs/comments/1dc81jt/how_to_build_astro_site_for_sharing_via_zip/

which suggests using this library:
https://github.com/ixkaito/astro-relative-links

Which I think has potential as an approach.

I'm worried, however, that the existing "push to github pages" may not work if we integrate a relative link strategy.

</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 26, 2026

Deploy Preview for avannotate-staging ready!

Name Link
🔨 Latest commit 60e9b5e
🔍 Latest deploy log https://app.netlify.com/projects/avannotate-staging/deploys/69c5526a0f0fe7000863ca04
😎 Deploy Preview https://deploy-preview-440--avannotate-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Add static site export with relative links Static site export with relative links Mar 26, 2026
Copilot AI requested a review from saracarl March 26, 2026 15:37
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.

static site export with relative links

2 participants