18f.gsa.gov
18f.gsa.gov copied to clipboard
Running ./serve-blog does not serve 3 latest blog posts
Expected Behavior
From the README:
./serve-blog
: This will eliminate all but the latest three blog posts, but keeps the rest of the site intact.
Actual Behavior
When I make a new blog post locally and run ./serve-blog
, I should see that blog post first when I visit http://0.0.0.0:4000/site/blog/. Instead, I see an older blog post:
"Ask 18F — Can you share any tips or suggestions on designing surveys and forms?" By Elaine Kamlley , Austin Hernandez April 5, 2018
Steps to reproduce the behavior
- Create a new blog post locally
- Run
./serve-blog
- Visit http://0.0.0.0:4000/site/blog
This issue is done when:
- I can create a new blog post locally, run
./serve-blog
, visit http://0.0.0.0:4000/site/blog, and see the new blog post.
@lsgitter Did you mean to close this one?
A little more info for when we end up addressing this issue. When I ran serve-blog
and then serve
, serve
showed the same two blog posts that serve-blog
did. This suggests that serve-blog
is a destructive command. It took manually deleting _site/
and re-running serve
to get all the blog posts to display.
I started looked at this issue, and it's doubtful that this script ever did exactly what it was supposed to do. It determines which posts to include based on a list of file names from the "./_posts" directory, which doesn't come back in date-order.
It's probably fixable, but I started wondering about the use case for this. Is there one? I am inclined to just delete this command.
I have discovered a different issue, which I think is probably worth trying to solve, which is that the pagination plugin doesn't seem to "see/render" a new blog post unless either you:
- delete the
_site
directory and reserve the files entirely or; - change a
.html
file (I discovered this when I was printing variables toblog/index.html
trying to determine whenpaginator.posts
updates)
This issue has been open for a long time, so I am inclined to:
- delete the
./serve-blog
file - delete associated config files (which were messy and mostly unnecessary anyways)
- delete documentation referencing this command
- open a new issue referencing the problem serving a new blog post.
If I don't hear from anyone on this ticket in the next week, I will assume that that's the right course of action and open a PR. Thanks!
I am not an expert, but if you can still preview changes to the blog locally without the ./serve-blog
then I have no issue deleting it and cleaning up the files.
My understanding is that the use case was to build the site with minimal content for speed, to more quickly iterate on changes.
(But I don't work on this repo at all, so you'll get no objections from me.)
@Dahianna I won't be eliminating the ./serve
command, which I assume is how folks are currently previewing changes, since ./serve-blog
doesn't work as expected!
@beechnut I think that was the idea, but it's unclear to me if that actually ever worked in effect!
thanks for your feedback, all.
I'm late to the party, but I'll toss in that I run my personal site on a Jekyll system like this, and every change I make takes about a minute to regenerate the whole blog. So if I'm updating something, I usually temporarily delete most/all the blog posts to make it take about 2 seconds. So I think the ./serve-blog
was intended to do the same thing.
tl;dr I agree with @beechnut.
Also I'm fine with removing that command and we can re-add it back if we ever find a way to make it work.