I’m trying to link to blog posts from an index displaying them all.
My index is being displayed like so:
<% page_articles.each_with_index do |article, i| %>
<%= link_to article.title, article %>
<% end %>
On my page, this link looks like mysite/blog-title
.
This page doesn’t exist, at least not there.
Alternately, if I display my index like this:
<% page_articles.each_with_index do |article, i| %>
<%= link_to article.title, article %>
<% end %>
On my page, the link looks like mysite/blog/articles/2019-04-12-blog-title.html
.
This page also doesn’t exist.
When I check my sitemap, (which doesn’t show the build directory, I guess by design?) it says the file is located in blog/launching-my-blog/
In my directory, this is the file structure:
>> build
>>>> blog
>>>>>> blog-title
>>>>>>>> index.html
>>>> images
>>>> javascripts
>>>> stylesheets
>>>> index.html
>> source
>>>> blog
>_>> index.html.erb (page where I list all blogs)
>>>>>> articles
>>>>>>>> 2019-04-12-blog-title.html.markdown
>>>> images
>>>> javascripts
>>>> layouts
>>>> stylesheets
>>>>> index.html.erb (my root index page, the one I edit)
>>>>> config.rb
>>>>> Gemfile
>>>>> Gemfile.lock
>>>>> index.html
>>> README.md
I’m a beginner and it’s very possible I messed up the directories somehow when I did my initial setup.
Which one of these should I point to and how should I structure the links?
Edit: Also, here’s my sources: blog.sources = 'articles/{year}-{month}-{day}-{title}.html'
blog.page_link = 'page/{num}.html'
Final edit: I fixed it! I used article.url instead of article.path. Is this okay?