Skip to content

chore(content): use relative URLs for links to local routes #94

Description

@kojiromike

Problem

Several markdown files under content/ link to local routes using absolute production URLs (e.g. https://www.open-emr.org/demo/, /chat, /donate/, /blog/post/...) instead of relative paths. On any non-production deploy — the GitHub Pages staging site at https://openemr.github.io/website-openemr/, a local hugo server, or any future preview build — clicking these links jumps the user from the build they're previewing back to the live production site, defeating the point of the preview.

Background

PR #93 fixes the staging site's broken stylesheets by overriding Hugo's baseURL at deploy time, so the staging build now emits same-origin asset URLs. That fix only covers asset URLs Hugo generates from baseURL — it does not rewrite absolute URLs that are hard-coded into markdown content. Templates under layouts/ and themes/openemr/layouts/ are already clean (no audit findings there); only content files are affected.

External references (wiki at open-emr.org/wiki/..., forum at community.open-emr.org, third-party sites) are intentional and out of scope.

Files / Symbols

Confirmed offenders (path:line — link target):

  • content/blog/covid19.md:37https://www.open-emr.org/donate/
  • content/blog/openemr-a-great-long-term-choice.md:22https://www.open-emr.org/demo/
  • content/blog/openemr-a-great-long-term-choice.md:28https://www.open-emr.org/chat
  • content/blog/openemr-offers-panel-of-turn-key-solutions-with-amazons-cloud-services.md:18https://www.open-emr.org/blog/post/openemr-announces-initial-availability-of-openemr-cloud-on-aws/
  • content/blog/openemr-offers-panel-of-turn-key-solutions-with-amazons-cloud-services.md:31https://www.open-emr.org/blog/post/hurricane-maria-puerto-rico-openemr-success/
  • content/blog/openemr-version-501-released-ushers-in-golden-age-for-openemr.md:30,32https://www.open-emr.org/blog/post/embracing-docker/
  • content/blog/openemr-version-501-released-ushers-in-golden-age-for-openemr.md:30,36https://www.open-emr.org/blog/post/openemr-at-wonca-2017/
  • content/blog/openemr-version-501-released-ushers-in-golden-age-for-openemr.md:30,38https://www.open-emr.org/blog/post/success-at-healthhacks-2017/
  • content/blog/openemrs-gsoc-2020-resounding-success.md:21https://www.open-emr.org/blog/gsoc-2020-hybrid-app
  • content/blog/openemrs-gsoc-2020-resounding-success.md:23https://www.open-emr.org/blog/gsoc-2020-work-product-modernize-openemr-user-interface
  • content/blog/openemrs-gsoc-2020-resounding-success.md:25https://www.open-emr.org/blog/gsoc-2020-work-product-fhir-integration-in-openemr
  • content/summer-of-code/_index.md:98https://www.open-emr.org/chat
  • content/winter-of-code/_index.md:17https://www.open-emr.org/chat
  • content/winter-of-code/_index.md:17https://www.open-emr.org/blog/you-can-be-a-openemr-developer-in-5-easy-steps/
  • content/winter-of-code/_index.md:47https://www.open-emr.org/chat
  • content/support/_index.md:28https://www.open-emr.org/chat

There may be more once you run a fresh search — see Reproduction.

Reproduction

From a fresh clone of the repo, list the candidates with:

git grep -nE 'https?://(www\.)?open-emr\.org/(demo|chat|donate|give|support|modules|blog/|blog$)' -- 'content/'

Verify that each match resolves to a route that actually exists in content/ (e.g. content/demo/, content/chat/, content/donate/ or content/give/ — note donate may now redirect to give per PR #81; check current state) before rewriting.

Approach

  1. Run the grep above to get the current list of offenders.
  2. For each match, confirm a corresponding local route exists, then rewrite the URL to the relative form Hugo expects:
    • https://www.open-emr.org/demo//demo/
    • https://www.open-emr.org/chat/chat/
    • https://www.open-emr.org/donate//give/ (verify; donation route may have moved)
    • https://www.open-emr.org/blog/post/<slug>//blog/<slug>/ (note: theme uses /:contentbasename/ permalinks per config.yaml:200, so the historical /blog/post/ segment is a redirect from the WordPress era and may no longer correspond to a current Hugo route — verify each slug resolves before rewriting)
  3. For any URL whose local equivalent does NOT exist (e.g. an old GSoC blog post that was never migrated to this Hugo site), leave it absolute or remove the link entirely — don't fabricate routes that 404.
  4. Build locally with hugo server and click each rewritten link to confirm it resolves.

Out of scope

  • External links to community.open-emr.org, open-emr.org/wiki/..., GitHub, third-party sites — those are intentionally absolute.
  • Menu and download URLs in config.yaml — same reason.
  • Template changes under layouts/ or themes/openemr/layouts/ — already clean.
  • The baseURL / Pages staging fix — handled in PR ci(deploy): override baseURL for Pages staging build #93.

Definition of done

  • git grep -nE 'https?://(www\.)?open-emr\.org/(demo|chat|donate|give|support|modules|blog/|blog$)' -- 'content/' returns no results, OR each remaining hit is documented in the PR as intentionally absolute (with a reason).
  • Local hugo server build: every rewritten link resolves to a real page (no 404s introduced).
  • Staging build at https://openemr.github.io/website-openemr/ (after merge): the same rewritten links stay within openemr.github.io/website-openemr/ instead of jumping to www.open-emr.org.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions