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
Allowing images in subdirs of /content #547
Comments
|
Thanks for the quick response @PhrozenByte I had read #530 earlier, but thought you might have rethought it a bit during the past 4 months. (With the caveat that I am a very poor programmer) I don't understand how keeping images out of the content folder enforces "separation of concerns." Images are, after all basic "content." Keeping Twig out of content files makes sense in regard to "separation of concerns" as Twig can act on something (and raw content should not be allowed to do so). Meanwhile, an image or video file do not execute anything or change anything, they are just displayed by the browser when called. Or am I misunderstanding your point? I looked at #545 and thanks to the clear explanation conceptually see the way forward, but writing the plugin is beyond me at the moment. |
|
There are some more things to consider security-wise (you really shouldn't allow users to access your raw Markdown files...), since we discussed this multiple times in the past it should be easy to find more details using GitHub's search engine. You won't need any development skills, just remove the access limitations from Pico's |
|
I'm not quite sure if my suggestion solves this problem, but for another CMS it does. |
|
Thanks @PhrozenByte !
Aha. This makes sense. I was in "static site generator" mindset and was not thinking of user's potential direct access to the directory. It makes me wonder whether an NginX rule could be written which allows PHP to access the .md files while users have no such access.
You are right, that I am reasonably comfortable with webserver config so that part would not likely be a problem. In #545, however, @marcus-at-localhost mentioned that a PicoCMS plugin would need to be written. That would probably be a challenge for me to accomplish in a reasonable time frame. This may be moot in any case:
|
|
@FBachofner not sure if I got this right, but here is how I do it: Lets assume this file structure:
You would access the page this way: With the .htaccess described here: #545 (comment) (I'm not familiar with NginX) you don't need a pico plugin, because the images are referenced correctly in the document The Pico plugin is only needed if you have to rewrite the image path, because it doesn't translate to the server path, caused by a markdown editor or whatever e.g. Then you can do some string replacement/removal like the following, in a pico plugin: in class Blog extends AbstractPicoPlugin
{
public function onContentPrepared(&$markdown)
{
$markdown = str_replace('/e/localhost/pico/content','',$markdown);
}
} |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! 👍 |
I conceptually like PhileCMS due to it allowing image (and other) related content "close" to posts (i.e. in the same folder).
Pico does not currently seem to allow for this.
Is there any chance that Pico 3.x will allow for such content organization? [ I am concerned that Phile has not seen an update in 2 years (abandoned?) . . . otherwise I might use it in production. ]
The text was updated successfully, but these errors were encountered: