Hello all.
I have a blog powered by Ghost:
Since it is just me and I like the way the author page looks, I would like the homepage (merecivilian.com ) to show the author page:
MereCivilian - Mere Civilian
Is that possible?
Any assistance is greatly appreciated.
I have attempted to add the following tot he routes file in Labs but that didn’t work:
routes:
/:
redirect: /author/mc/
Many thanks
Thank you @joe-blocher
Unfortunately that didnt work. I uploaded the new redirects.yaml file:
It gives an error:
it says too many redirects.
To prevent that, start with ^/ , which will cause it to match only a / when it starts the path…
But, just so that we’re clear, a redirect is going to cause the visitor to get sent to /author/mc, not cause the author/mc content to show up at /. Is that what you’re wanting?
1 Like
Cathy_Sarisky:
But, just so that we’re clear, a redirect is going to cause the visitor to get sent to /author/mc, not cause the author/mc content to show up at /. Is that what you’re wanting?
This is not what I am after. I want merecivilian.com to show the contents of merecivilian.com/author/mc/
Right, then you don’t want a redirects file. You want a routes file.
This might work.
routes.yaml (uploaded through labs):
routes:
/:
template: author
data: author.mc
collections:
/blog/:
permalink: /{slug}/
template: home
(add the tag and authors section like normal)
That should:
create a / route that uses the author template and gets the data for ‘mc’ into it
create your ‘index’ of your blog posts at /blog/ (note: depending on theme, you might need template: index
instead
keep the blog posts at /{slug}/ so that you don’t break inbound links. If your blog posts are currently somewhere else, you should adjust, of course!
3 Likes
Thank you @Cathy_Sarisky
so I added the following and also tried changed the index to home:
Noting, the above is the only thing in my routes.yaml file.
It gives the following error:
Check out this older post. The indenting is wrong, but I think the solution is there:
Hi @Kate , hi ghost-team,
any news on the issue, that the ghost header is not displayed?
Looks like the same problems exists here too: Page route for homepage, and blog issue - #4 by Kate
Update:
Looks like I’ve found two bugs when using this sort of route, the <nav class="site-nav"> is rendering in the source code, but the screen.css has a wrong sizing. If you modify the top to 0, the navigation is back again:
.home-template .site-nav {
position: relative;
top: -70px; → top: 0
But what…
redirects.yaml
301:
^/: /author/mc/
worked for me.
But the route /author/mc is visible in the browser.
@Cathy_Sarisky suggestion also fits. Is better than a redirect:
routes:
/:
template: author
data: author.mc
If you are self-hosting you can use a 301 redirect rewrite on Nginx or the proxy you are actually using as well.
I used the redirect solution proposed by @joe-blocher and now anyone going to my homepage is redirected from https://merecivilian.com/ to MereCivilian - Mere Civilian
It is not ideal because it redirects rather than showing the author page on the home page (merecivilian.com ) but will see how I go.
I suppose this is the benefit of a personal project. I can change things at my will
many thanks to @Cathy_Sarisky @joe-blocher
1 Like
The initial topic is solved but not your issue, you just need to use routes for that.
301 means entering to a page and jumping to another.
You are right @satonotdead
My issue is still unresolved. I attempted numerous routes suggested here but none appear to work for me
I am still using the redirect option on my blog but I may revert to the traditional setup.