Skip to content

🐛 BUG: Astro.site should resolve to localhost:PORT when on dev server, even if site is set in astro.config.mjs #1319

@jasikpark

Description

@jasikpark

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

You can see in astro/docs that Astro.site resolves to https://docs.astro.build/ when running the dev server, rather than localhost:3000, which is what I would expect Astro.site to resolve to, similar to Hugo

Steps to Reproduce

  1. clone astro project
  2. yarn
  3. yarn build
  4. yarn workspace docs start
  5. Print out console.debug(Astro.site):
URL {
  href: 'https://docs.astro.build/',
  origin: 'https://docs.astro.build',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'docs.astro.build',
  hostname: 'docs.astro.build',
  port: '',
  pathname: '/',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}

console.debug(Astro.site.toString()) => https://docs.astro.build/

@chenxsan sorted out that it's probably set in https://github.com/snowpackjs/astro/blob/main/packages/astro/src/runtime.ts#L93

Link to Minimal Reproducible Example (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions