# \[SOLVED\] Pages from collection list are not render

**URL:** <https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059>\
**Category:** Help\
**Created:** [October 6, 2017, 7:47pm UTC](https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059 "2017-10-06T19:47:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![guillaumemda](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/guillaumemda/32/515_2.png) [@guillaumemda](https://talk.jekyllrb.com/u/guillaumemda)\
**Post date:** [October 6, 2017, 7:47pm UTC](https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059/1 "2017-10-06T19:47:46Z")

</div>

Hello all,

I’m writing here about a problem I met, as I’m not sure it is a bug…

I try to render pages from a collection.

I’ve created a directory **\_collection/** in the root of a project. I put inside some files: authorA.\*md, authorB.\*md, etc.  
I have a page: authors-list.\*md to list all the authors from \_collection directory with an include:

```
{% include list-collection collection='authors' %}
```

 from an include page that define this:

```
 {% for page in site.[include.collection] %}
 {% unless page.published == false %}
 a href="{{ site.url }}{{ page.url }}">{{ page.title }}
 {% endunless %}
 {% endfor %} 
```

The page _authors-list_ render quiet well the list of all titles of the .md pages from \_collection/.  
But when I click on one of the title of the list (for example authorA), the page is redirected to a 404 page… But the URL is showing the right path: www.mysite.tld/myjekyll-site/collections/authorA/

In the \_config.yml, if I set a permalink for my collection like this:

```
collections:
   authors:
     output: true
     permalink: '/:collection/:path/
```

the URL become wrong, as it redirects to: _www.mysite.tld/collections/authorA/_ (it miss the _/myjekyll-site/_);  
but I’m able to access to the page if I manually enter _www.mysite.tld/myjekyll-site/collections/_ from which I can see the index and from here to go to my page…

If I do like this:

```
permalink: ‘/myjekyll-site/:collection/:name’
```

 (or **/:path/** ) the URL is right, but redirect anyway to a 404 page…  
and I can’t even reach the index of the directory to find the page…

So, I don’t know so much what to do…

I’m using Jekyll 3.6.0, and I’m actually in localhost.

Hope to find a solution.

Cheers

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [October 6, 2017, 8:24pm UTC](https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059/2 "2017-10-06T20:24:29Z")

</div>

are you using baseurl? it sounds like you should be. If your files are not in the root directory and are instead in a sub folder then baseurl should be in your urls so that the links go to the sub folder rather than the root.

You say you are working locally but your examples are with a fake domain/tld, it may be easier for us if you show us the real links including localhost as it will be more accurate. But it sounds like a baseurl problem of some sort. That can be weird to diagnose though as jekyll will change the url for local dev under some circumstances.

Are you running jekyll build or jekyll serve when you preview the site?

Also, I would not recommend naming a collection collection - that seems like a bad idea though it sounds like it is working.

---

<div class="post-metadata">

**Author:** ![guillaumemda](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/guillaumemda/32/515_2.png) [@guillaumemda](https://talk.jekyllrb.com/u/guillaumemda)\
**Post date:** [October 6, 2017, 8:51pm UTC](https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059/3 "2017-10-06T20:51:32Z")

</div>

Hi,  
thanks for answer.

Ok, I’m going to be more clear and give example as I used them.

Yes, I’m using baseurl.

I’ve set my \__config.yml_ like this:  
``

```
url: 'https://mydomain.ltd’
baseurl: ‘/magazine’
```

The collection name is ‘authors’.

The full URL to the file, for example authorA.\*md, is (on my computer) : **localhost:4000/magazine/authors/authorA/**

If I set the permalink like this: **‘/magazine/authors/:name’** , the URL is right but the page is not rendered.

If I set the permalink like this: **‘/authors/:name’** or **‘/:collection/:name’** , the URL is wrong, but I can access to the page by the index of the directory manually.

I’m running jekyll serve to preview my site. Jekyll changes automatically ‘https :// mydomain.ltd’ in ‘localhost:4000’.

Are you suggest/recommend to work directly on a live server and not on localhost?

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [October 6, 2017, 8:59pm UTC](https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059/4 "2017-10-06T20:59:47Z")

</div>

local is good, just asking to know more.

`a href="{{ site.url }}{{ page.url }}">{{ page.title }}`

I think you need to have baseurl in here.

---

<div class="post-metadata">

**Author:** ![guillaumemda](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/guillaumemda/32/515_2.png) [@guillaumemda](https://talk.jekyllrb.com/u/guillaumemda)\
**Post date:** [October 6, 2017, 9:14pm UTC](https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059/5 "2017-10-06T21:14:15Z")

</div>

Yes, it’s working!

I write it like this ``

```
a href="{{ site.url }}{{ site.baseurl }}{{ page.url }}">{{ page.title }}
```

Just that now the URL is quiet strange (but working!), as it add a baseurl name: it becomes:  
localhost:4000/magazine/magazine/authors/authorA… (2x magazine)

But maybe, as you said (if I’m right), it’s because Jekyll change sometimes the url on a local dev?

Anyway, thank you very much **rdyar**!

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [October 6, 2017, 9:27pm UTC](https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059/6 "2017-10-06T21:27:10Z")

</div>

magazine is your baseurl, and then maybe you have it in your permalink also, sounds like you could remove it there.

and yes, I find the localhost/baseurl/siteurl magic a little much - I generally do not use baseurl or siteurl, but I don’t host on GH usually and I am not making a theme to give others so I just use relative urls and if I need the full url I hard code it. I also only host at the root - not in a sub folder where you need baseurl.

Jekyll serve will swap out site url, jekyll build will not. I think that is what goes on. Although I think it also does something with baseurl - I thought it dropped it locally but not according to your links.

---

<div class="post-metadata">

**Author:** ![guillaumemda](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/guillaumemda/32/515_2.png) [@guillaumemda](https://talk.jekyllrb.com/u/guillaumemda)\
**Post date:** [October 6, 2017, 9:34pm UTC](https://talk.jekyllrb.com/t/solved-pages-from-collection-list-are-not-render/1059/7 "2017-10-06T21:34:49Z")

</div>

I’ve change the permalink in \_config.yml, but still have 2 times the baseuri appear in the URL.

But I will investigate in other files. Maybe there is a permalink somewhere or else…

Thanks again!
