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

Slim pages are not rendering / not found #58

Open
candland opened this issue Apr 11, 2024 · 1 comment
Open

Slim pages are not rendering / not found #58

candland opened this issue Apr 11, 2024 · 1 comment

Comments

@candland
Copy link

I'm using slim in the project and the slim layouts render fine, but if I add a page content/pages/test-slim.html.slim

Going to /test-slim.html goes to not found / no route matches.
Going to /test-slim.html.slim downloads the file.

I'm using 4.0.2 with markdown set up (works, as well as erb).

Rails 7.1.0

Installed following the docs, but I did have to override the controller to skip some actions I have in ApplicationController.

class SiteController < ApplicationController
  include Sitepress::SitePages

  skip_scoped_check :show
  skip_authorized_check :show
end

# in routes
sitepress_pages root: true, controller: "site"

Another interesting thing, it shows up in PageModel.all and links to it, but with the .slim extension.

Any idea what I'm missing?

@candland
Copy link
Author

candland commented Apr 12, 2024

Found what's going on. For some reason slim isn't being added to ActionView::Template::Handlers.extensions. Interesting that it's rendering okay outside of Sitepress.

When this runs, it's not there and Sitepress doesn't register any .slim pages.

Sitepress::Path.handler_extensions = ActionView::Template::Handlers.extensions

To Fix

Added config/initializers/sitepress.rb.

ActionView::Template::Handlers.extensions << :slim

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

1 participant