Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support prefixed deployments in the www theme / search app #1365

Open
gumaerc opened this issue Mar 5, 2024 · 2 comments
Open

support prefixed deployments in the www theme / search app #1365

gumaerc opened this issue Mar 5, 2024 · 2 comments

Comments

@gumaerc
Copy link
Collaborator

gumaerc commented Mar 5, 2024

Description/Context

In ocw-studio, you can use the upsert_mass_build_pipeline management command to generate a pipeline in Concourse that will build all publishable websites that ocw-studio knows about and deploy them. This command has an argument called --prefix. When this argument is set the prefix is applied to the baseURL argument when Hugo is run, and the site is deployed to the prefixed URL.

In the www theme, we have a number of hard coded links that do not respect the Hugo baseURL setting. Search results from the search app also do not respect this setting. So, in order for the prefixed sites to be fully self-contained, we will need another way to set the prefix so it can be respected when building a root website with the www theme.

Plan/Design

  • Create an environment variable for storing the prefix, something like OCW_OUTPUT_PREFIX (name tbd)
  • If this prefix is set, apply it to links that need it (this list may not be complete and should be updated):
    • Header links
      • Logo (home)
      • About
      • Contact
    • Course carousels
      • Featured Courses
      • New Courses
    • Home page collections
    • OCW Stories
    • Footer links
      • Terms & Conditions
      • About
    • Search
      • Search and explore buttons on home page
      • Links to search results
        • Courses
        • Resources
      • Link to terms & conditions page at the bottom of the facets area
@ibrahimjaved12
Copy link
Contributor

Just confirming, should this be in Needs triage or Ready ?

@gumaerc
Copy link
Collaborator Author

gumaerc commented Mar 6, 2024

Just confirming, should this be in Needs triage or Ready ?

As long as there isn't anything else high priority, I'd say you can grab it. I put it in "needs triage" because fixing this isn't really super critical. There are plenty of workarounds for viewing prefixed pages that aren't too frustrating to use, such as visiting pages directly. I put up the other PR in ocw-studio because it was an easy win. We only had to change a few lines of code to get Hugo to render the prefix. This one is a bit more complicated, and will require another PR in ocw-studio afterward to set the env variable mentioned above.

Another complication that comes to mind, now that I'm thinking about it, are the links built into search. Since we build theme assets once per branch of ocw-hugo-themes using the theme assets pipeline, then consume those with each site build, whatever env value is used during the theme assets build will determine what the links in search results are. So, it would be impossible to create two different prefixed builds pointing at the same branch of ocw-hugo-themes. I don't think this is something we would commonly do, if ever, but it does make the --prefix argument on the mass build pipeline a bit disingenuous because setting the prefix there would do nothing for the links in search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants