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

Landing page #111

Open
mwhelan opened this issue Apr 13, 2014 · 13 comments
Open

Landing page #111

mwhelan opened this issue Apr 13, 2014 · 13 comments

Comments

@mwhelan
Copy link

mwhelan commented Apr 13, 2014

I'm pretty sure Snow can already handle this, but I would appreciate some advice on how to do it. I have my website setup as normal, with the home page being the post listing page. What I would like to do instead is make the home page a landing page and have the post listing be a page that you link to from the home page.

Any suggestions on how I can do that?

Thanks

@phillip-haydon
Copy link
Member

In the snow.config theres a processFiles array.

The index file processes the posts.

Change the index.cshtml to posts.cshtml

Then create a new index.cshtml like the categories.cshtml or archive.cshtml


I think that should work. I would have to test though.

Glad you're raising issues, you have an interesting use-case :D

@mwhelan
Copy link
Author

mwhelan commented Apr 13, 2014

Hi @phillip-haydon , thanks for your help! I've actually been messing about with permutations of that all morning. If I understand you correctly then my config should look like this:

"processFiles": [{
    "file": "posts.cshtml",
    "loop": "Posts"
  },{
    "file": "index.cshtml"
  },{  
    "file": "category.cshtml",
    "loop": "Categories"
  },{
...

When I do that, the posts.cshtml file displays as the home page and not index.cshtml as I would have expected?

@mwhelan
Copy link
Author

mwhelan commented Apr 13, 2014

Yeah, what is happening is that posts.cshtml is being written out as index.html in the root. Nothing is happening with the index.cshtml file I created for the landing page.

@mwhelan
Copy link
Author

mwhelan commented Apr 13, 2014

which is hard coded into PostsProcessor

@mwhelan
Copy link
Author

mwhelan commented Apr 13, 2014

and the

"file": "index.cshtml"

creates a folder called index with an index.html in it.

@phillip-haydon
Copy link
Member

"file": "index.cshtml"

Change that to:

"file": "index.cshtml => ./index.html"

The other issue with the PostsProcessor needs to be fixed. :(

@mwhelan
Copy link
Author

mwhelan commented Apr 13, 2014

Thanks Phillip. That does fix the index.html file going to the root. Because of the PostsProcessor issue though, the compiler errors writing the index.html file because the Posts index.html file already exists in that location.

As a workaround can I make all the posts go into a "posts" directory? Presumably that would put the Posts index.html into that folder? It's not ideal from a url perspective, but good to know what options there are.

Thanks

@phillip-haydon
Copy link
Member

Hmmm it might be possible to run the posts from /posts/index.cshtml

{
    "file": "/posts/index.cshtml",
    "loop": "Posts"
  }

Which would put it under the sub folder /posts in theory.

Otherwise I need to do a code fix.

@mwhelan
Copy link
Author

mwhelan commented Apr 13, 2014

Only had a brief look at it but that didn't seem to do it. What would be involved with a code fix? How could this feature ideally work?

Thanks.

@phillip-haydon
Copy link
Member

Not much to code fix, looking at it now, just a case of being able to do => posts.html for the name of the index file.

I'll add a new issue to look at being able to throw it in a folder in the future. That would be handy.

@mwhelan
Copy link
Author

mwhelan commented Apr 13, 2014

So, there would be a posts\index.html, but urls wouldn't have /posts/ added?

That sounds excellent!

Sent from my iPad

On 13 Apr 2014, at 13:26, Phillip Haydon notifications@github.com wrote:

Not much to code fix, looking at it now, just a case of being able to do => posts.html for the name of the index file.

I'll add a new issue to look at being able to throw it in a folder in the future. That would be handy.


Reply to this email directly or view it on GitHub.

@phillip-haydon
Copy link
Member

Pretty much got this working.

Making some notes here so I can add them to wiki later:

Scenario 1:

{
    "file": "index.cshtml",
    "loop": "Posts"
}

Currently works as it does now, creates a file called index.html in the root directory, and all sub directories are page2 with an index file.


Scenario 2

{
    "file": "posts.cshtml",
    "loop": "Posts"
}

Works the same as index.cshtml, except the expectation is that the file created in root is posts.html instead of index.html


Scenario 3

{
    "file": "index.cshtml => posts.html",
    "loop": "Posts"
}

Acts like Scenario 1 except the source file and destination file are explicit, rather than inferred.


Scenario 4

{
    "file": "index.cshtml => /posts/",
    "loop": "Posts"
}

Assumes the file is index.html except the the destination folder is posts, all paging will be sub folders of the posts folder.


I think that covers all. Need to write a lot of unit tests!

@mwhelan
Copy link
Author

mwhelan commented Apr 13, 2014

That is awesome Phillip. Thanks for the time and effort. The scenarios look pretty comprehensive!

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

2 participants