question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include Template Path in hydrogen.routes.js

See original GitHub issue

Is your feature request related to a problem? Please describe.

I really like what hydrogen does. I’m looking to build a simple static site without client side rendering and there just aren’t options that will take a list of paths, data, and a template and render it to an HTML file.

Hydrogen is the closest things I’ve seen, the only thing it lacks is the ability to explicitly define the template to use… instead it falls back to _index.js in the folder of the routes defined in hydrogen.routes.js.

While this solution works, it doesn’t allow the user to use two different templates within the same folder of their site structure.

Such as having both /contact and /about.

Describe the solution you’d like Reading over how getPages.ts works, I believe it should be doable to allow users to explicitly define the template to use.

Something such as would work well:


  {
    path: "/blogs/setting-up-a-service-worker",
    data: {
      post: 2
    }
   template: "/path/to/template/"
  }

This would allow the user to define their entire site in the hydrogen.routes.js file and then just worry about templates.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
nickreesecommented, Jan 23, 2020

I ended up deciding to roll my own solution to fix the specific use case I have. Thanks.

0reactions
ShailenNaidoocommented, Feb 22, 2020

@nickreese Thanks for the clarification! That fits with what I was thinking as well. I will add this feature to the board for a future release 😄

Currently, I am planning on rebuilding Hydrogen for modularity

Read more comments on GitHub >

github_iconTop Results From Across the Web

Routing - Shopify.dev
The Hydrogen framework uses a file-based routing system. This guide provides an introduction to how routing works in your Hydrogen storefront. How routes...
Read more >
Issues · hydrogenjs/hydrogen - GitHub
... template generation. - Issues · hydrogenjs/hydrogen. ... hydrogenjs / hydrogen Public. Sponsor ... Include Template Path in hydrogen.routes.js.
Read more >
Create a Product Page with Hydrogen - Shopify
Most of the files that you'll work with in your Hydrogen project are located in the /src directory. We'll be diving in there...
Read more >
Shopify Hydrogen | Edgio Documentation
2npm init @shopify/hydrogen -- --template demo-store-js ... The @edgio/core package - Allows you to declare routes and deploy your application on Edgio ...
Read more >
ng-include and ngRoute: how to make them work together ...
templates is an array in your mainController which has the url or path of all your subtemplates.When you use ng-include inside the main...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found