-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Feature: GetJson and GetCsv in short codes or other layout files. #748
Feature: GetJson and GetCsv in short codes or other layout files. #748
Conversation
There are som failing tests on Windows. See the AppVeyor details above. |
f3ddfde
to
47f3134
Compare
Fixed |
I guess @spf13 will chime in, but my first thoughts: I love the simplicity of this approach. I know I was the one who wanted a cache for the remote resources, and I still believe that is important. But I had a hope that there was a third-party Go cache libraries out there to use -- cause I would like that my cache entries was evicted and refreshed at some point (I want fresh content - but not on every livereload). Other than that, this looks great -- a feature I look forward to use. |
@ahsanulhaque You are the editor (or something) of the gopheracademy and have seen a lot of blog articles floating by - any good Go caching library out there? |
Hey, it really depends on what kind of caching you're trying to achieve. This is a fairly popular library and I've seen it used in many cool ways. I would probably write something minimal and use Redis. |
IMHO it would be easier to add a 2nd integer parameter to getJson/getCsv which specifies the cache validity in seconds.
|
I like the idea of caching it. My thoughts are using a tmp/ directory or cache/.
We should add a setting --ignoreCache or something if we go this route. We can also in the future easily build in some expiration functionality if we start here. It's easy enough to check the mtime on the file and choose not to use it. This does mean that we do need to wrap all external calls to check cache first. There's probably a number of places where a cache would be helpful if we sit down and think about it. |
+1. |
47f3134
to
b22200e
Compare
@spf13 I feel the API here is pretty set in stone (simple and clear). There may be stuff to improve on caching and documentation, but there are arguments to pull it in as a "silent feature" for a while ... to play with it and get a feeling. |
👍 Great idea! |
I should resolve the merge conflict and add the option |
bdbbb59
to
8f196ea
Compare
8f196ea
to
a050541
Compare
I've added the option ignoreCache, fixed a bug when the cache folder didn't exists and also rebased my branch with the current commits from master. |
bfa67c4
to
3cde160
Compare
3cde160
to
9b46409
Compare
up ! |
I have it running with the fork github.com/SchumacherFM/hugo. But the url I want to call is composed with prefix + id + sufix
Is there a way to concatenate vars to build this composed url ?? |
printf - see a recent discussion in the forum. |
d524094
to
1dfcfa3
Compare
I've just started writing and ... how should I name the new page in the docs?
Is my current favourite but not really a nice one. Has someone a better idea = name? |
Dynamic Pages is how they call it on Middleman. |
I like dynamic content |
1dfcfa3
to
b7702b1
Compare
Documentation has been added! Please report any weird stuff and also if it is ok to include future features (people will get more excited about hugo 😋 ) |
The documentation should be about the current feature-set. Nobody knows what the future brings. |
Moved it to another branch. Anything else ok? |
b19dc43
to
645db4f
Compare
Feature: GetJson and GetJson in short codes or other layout files. For more details please see: http://cyrillschumacher.com/2014/12/21/dynamic-pages-with-gohugo.io/
cache directory for reading but still writes to it" as @spf13 suggested.
… pre or post parts of an URL. The parts will be joined to the final URL.
$TMPDIR/hugo_cache/ directory.
645db4f
to
866ce16
Compare
I've merged this in. Excellent contribution @SchumacherFM. Looking forward to more. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have finished the integration of getJson and getCsv into hugo as far as I think it fits.
I'm not a hugo (and Go) expert of where to put these functions and correct naming of functions and vars.
I would be glad if you can comment on spotted errors, bugs, bad design, etc. or even help me to improve the code more.
All tests and the new tests are passing. Goimports has reordered some import paths.
I have written a blog post about that new feature: http://cyrillschumacher.com/2014/12/21/dynamic-pages-with-gohugo.io/
There is not yet any official documentation because I want to get the code right. I think once this feature is merged as a hidden feature into hugo and some people tested it in the wild with no given complaints I will write the docs.
Looking forward for a successful merge :-)