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

force build individual files #2881

Closed
RobinD42 opened this issue Jul 24, 2017 · 5 comments
Closed

force build individual files #2881

RobinD42 opened this issue Jul 24, 2017 · 5 comments
Assignees
Labels

Comments

@RobinD42
Copy link

Enhancement request

It would be nice to be able to force the rebuild of one page/post (and any that depend on it) instead of needing to do nikola build -a and rebuild everything. For example, I have a shortcode template that pulls a few posts into a normal page. I know that whenever the newest few posts are updated that I need to ensure that this page is rebuilt too, but currently I either have to do a build -a, make some arbitrary change in the page, or remove the files for that page from cache and running the build. This is basically the same problem mentioned in the docs about the post-list directive.

An alternative idea would be to be able to specify in the page's metadata the slugs and/or section-slugs that would cause it to be out of date and need to be rebuilt. Something like .. depends: news, some-other-page

@Kwpolska Kwpolska self-assigned this Jul 25, 2017
@Kwpolska
Copy link
Member

Hello, and thanks for choosing Nikola for the wxPython website!

First, the feature you’re asking for already exists. nikola build -a output/foobar.html will rebuild that file, although it might still rebuild too much (it seems like all files in cache/ are rebuilt for a single post).

However, there is a better solution. Shortcodes always return a list of their dependencies. In templated shortcodes, the usual include directive of your template system should make the included files dependencies (assuming there are no bugs there). However, if you use Python-based shortcodes, you can then specify any dependencies you want, including '####MAGIC####TIMELINE' (which is what post-lists use) to force a rebuild every time any post/page changes.

But in this exact case, you don’t even need to do that. This can be solved with the post list directive (also available as a shortcode) and a custom post-list template, with the added benefit of avoiding ugly Mako code.

@RobinD42
Copy link
Author

Thanks, I hadn't noticed the template parameter to the post-list directive yet. I can make that work.

However it would still be nice to be able to define extra dependencies in some way. I expect that there could potentially be some other use cases that could benefit from it.

@Kwpolska
Copy link
Member

If someone can name a genuine use-case, and the need for manual dependency specification can’t be worked around easily, we can implement that. Otherwise, it’s not worth the hassle, and it makes Nikola look bad because we can’t manage dependencies right.

@RobinD42
Copy link
Author

Ok, that makes sense.

@felixfontein
Copy link
Contributor

If you need special dependencies computed for whatever reason, you can also write a plugin which inserts these dependencies. Nikola is flexible enough to do that. (You can even write a plugin which allows you to specify dependencies via meta. I agree with @Kwpolska that there shouldn't be a need for such a plugin.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants