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

Permalinks #1981

Closed
bbohling opened this issue Jan 18, 2014 · 6 comments
Closed

Permalinks #1981

bbohling opened this issue Jan 18, 2014 · 6 comments

Comments

@bbohling
Copy link

I'm sure I'm missing something silly, but I wanted to setup my permalinks WITHOUT the day. I've updated frontend.js to include these 2 edited lines:

server.get(/^\/([0-9]{4}\/[0-9]{2}\/)?([^\/.]*)\/$/, frontend.single);
server.get(/^\/([0-9]{4}\/[0-9]{2}\/)?([^\/.]*)\/edit\/$/, frontend.edit);

And updated the permalink value in the database table, settings.Not necessary, but I even updated the ghost.js, views.js, and settings.js, but still I cannot get it to use the new pattern (get 404). Again, I know it's something silly I'm missing. Anyone know what I'm missing?

@larshanw
Copy link

Just go to http://you-url.com/ghost/settings/general/ and uncheck Dated Permalinks option.

@jgillich
Copy link
Contributor

Why don't you just use a web server in front of Ghost to redirect the urls?

@bbohling
Copy link
Author

@larshanw, I still want the /:year/:month

@jgillich, of course I can do that but I didn't want the extra layer of logic. Not only is it a (slight) performance hit but it is also another configuration to manage. May not sound like a big deal in either case, but I work hard to keep my web implementations as performant and simple as possible.

@jgillich
Copy link
Contributor

The problem might be that the single route verifies the date format and calls next() when incorrect (which 404s, because there is no other route).

@hswolff
Copy link
Contributor

hswolff commented Jan 19, 2014

There's additional logic for how permalinks are handled in the controller: https://github.com/TryGhost/Ghost/blob/master/core/server/controllers/frontend.js#L68

Undoubtedly you'll need to modify the code there as well to suit your needs.

More flexible permalinks are coming: #1631 however.

@bbohling
Copy link
Author

Thanks @hswolff! I finally was able to take a look at your suggestion and of course it was drop dead simple. Simply edit line 98 (my version was actually 101) to remove the DD/:

if (dateInSlug && req.params[0] !== moment(post.published_at).format('YYYY/MM/')) {

So I am good to go until it is baked into master. Thank you!

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

No branches or pull requests

4 participants