7. Ship to GitHub Pages

Export your site, host it under a repository sub-path, and publish it with a GitHub Actions workflow.

On this page
bash
dotnet run -c Release -- --bevel-build

This is the last step. You export the site as plain files and put them on GitHub Pages. You can host the same files anywhere that serves static files.

  1. Export once by hand

    bash
    dotnet run -c Release -- --bevel-build

    Bevel renders every page, writes it to wwwroot/, and exits. You should see index.html, schedule/index.html, a folder for each session and speaker, and calendar.ics. Open wwwroot/index.html in a browser to check it.

    Export with -c Release. A Debug build runs build-time code as Development, which keeps drafts. See Drafts and removing items.

  2. Add the path base

    A GitHub project site lives at https://you.github.io/bevel-conf/, not at the root. Every link has to start with /bevel-conf. The sample reads the prefix from an environment variable, so the same code works on your machine and in CI. It also sets SiteUrl, the origin of the published site, from BEVEL_SITE_URL. The calendar feed uses it to write absolute session links:

    samples/Bevel.Conference/Program.cscsharp
    // Hosted under a sub-path (GitHub Pages project sites)? Set it here and every link and asset follows.
    // Pass it from the environment so the same code works locally and in CI: BEVEL_PATH_BASE=/bevel-conf
    builder.AddBevel(options =>
    {
        options.PathBase = Environment.GetEnvironmentVariable("BEVEL_PATH_BASE") ?? "";
        // The origin of the published site. The calendar feed needs it for absolute session URLs.
        options.SiteUrl = Environment.GetEnvironmentVariable("BEVEL_SITE_URL") ?? "https://example.com";
    });

    Export with a path base:

    bash
    BEVEL_PATH_BASE=/bevel-conf BEVEL_SITE_URL=https://you.github.io dotnet run -c Release -- --bevel-build

    Open wwwroot/schedule/index.html and look at the links. They start with /bevel-conf/. The files are not moved. Bevel still writes schedule/index.html. You upload the folder to the /bevel-conf/ location.

  3. Add the workflow

    Create .github/workflows/pages.yml:

    .github/workflows/pages.ymlyaml
    name: Pages
    
    on:
      push:
        branches: [main]
      workflow_dispatch:
    
    permissions:
      contents: read
      pages: write
      id-token: write
    
    concurrency:
      group: pages
      cancel-in-progress: true
    
    jobs:
      build:
        runs-on: ubuntu-latest
        env:
          DOTNET_NOLOGO: true
          DOTNET_CLI_TELEMETRY_OPTOUT: true
          DOTNET_gcServer: 0
          # Serve under https://<user>.github.io/<repo>/
          BEVEL_PATH_BASE: /${{ github.event.repository.name }}
          BEVEL_SITE_URL: https://${{ github.repository_owner }}.github.io
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-dotnet@v4
            with:
              dotnet-version: 10.0.x
          - name: Export the site
            run: dotnet run -c Release -- --bevel-build
          - uses: actions/upload-pages-artifact@v3
            with:
              path: wwwroot
    
      deploy:
        needs: build
        runs-on: ubuntu-latest
        environment:
          name: github-pages
          url: ${{ steps.deployment.outputs.page_url }}
        steps:
          - id: deployment
            uses: actions/deploy-pages@v4

    The workflow installs .NET, runs the export with the path base set from the repository name, uploads wwwroot, and deploys it. If your project is not in the repository root, add working-directory to the export step and point path at that project's wwwroot.

  4. Turn on Pages

    In your repository, open Settings → Pages. Under Build and deployment, set Source to GitHub Actions. Push to main. The workflow runs, and the deploy job prints your site's URL.

Run it

Open https://<you>.github.io/<repo>/. You should see the finished site: speakers, schedule, session pages and a calendar link that works.

The finished Bevel Conf 2027 home page.
Step 7: the finished site, live.

When something is off

  • Links go to the wrong place. The path base is missing or has no leading slash. It must look like /repo.
  • Missing styles. The stylesheet link did not use Links.Asset. Use Links.Asset("/css/site.css").
  • A hand-written href="/about" does not work. Bevel does not rewrite hand-written links in your markup. Use Links.To<AboutPage>(), or Links.Route("/about") for a route without a page.
  • The export fails with "no MapStatic route". A Links.To or Links.Route call points at a route you did not map. Fix the link or add the route.
  • CS8974 when you build. You wrote href="@Links.To<HomePage>()". Add parentheses: href="@(Links.To<HomePage>())".

Next: Where to go next.