How to make routes point to the same page? (routes.yalm)


#1

Hello,

I have created a page that can be accessed at domain/somePage/
How can I make it so that if I navigate to domain/somePage/somethig/ or domain/somePage/somethig/somethingElse/ renders domain/somePage/ without redirecting.
Basically domain/somePage/(.*) to always open domain/somePage/ but without redirecting (something similar to mod_rewrite)

:slight_smile:

  • What version of Ghost are you using? 2.2.4

#2

As far as i understand, you want to show the same content on multiple urls?


#3

Yes.


#4

Any ideas how to do it?


#5

I think you could do something like this (not tested).

routes:
  /page1/:
    data: page.static
    template: example

  /page2/:
    data: page.static
    template: example

example.hbs

{{#page}}
  {{content}}
{{/page}}

#6

Can I use regex?
What I mean is, if i have url:
/page1/page2/page3โ€ฆ to show /page1
/test1/test2/test3 to show /test1
Without redirecting, keeping the url in the browser unchanged.


#7

No


#8

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.