How can I load data from yml files onto a HUGO template? I am having trouble understanding the documentation, what would be the steps?
I am using the hyde template.
Given a Yaml-file named mydata.yml:
Put this file into the folder /data inside your Hugo project. If it doesn't exist, create it. The exact name is important.
From the template you can then access the Yaml file as a data structure with $.Site.Data.mydata. Nested elements can be accessed by so called dot chaining: $.Site.Data.mydata.author.name
Related
I am trying to copy folders with their files from ftp into an azure data storage, by looping through the folders and for each folder copy the content into a container that has the folder's name. for this, I used a metadata ,for each and copy data component. For now I am able to copy all the folders into the same container , but what I want is to have multiple containers named after the the folders in the output, each one containing files from the ftp.
ps : I am still new to azure data factory
Any advise or help is very welcome :)
You need to add a Get Metadata activity before the for-each. The Get Metadata activity will get the files in the current directory and pass them to the For-Each. You connect it to your Blob storage folder.
try something like this
Setup a JSON source:
Create a pipeline, use GetMetadata activity to list all the folders in the container/storage. Select fields as childItems
Feed the Metadata output (list of container contents) into filter activity and filter only folders.
Input the list of folders to a ForEach activity
Inside ForEach, set the current item() to a variable, and use it as a parameter for a parameterized source dataset which is a clone of original source !
This would result in listing the files from each folder in your container.
Feed this to another filter and this time filter on files. Use #equals(item().type,'File')
Now create another pipeline where we will have our copy activity running for each file found to be having same name as that of its parent folder.
Create parameters in the new child pipeline to receive the current Folder and File name in the iteration from Parent Pipeline to evaluate for copy.
Inside child pipeline, start with foreach whose input will be the list of filenames inside the folder received into parameter: #pipeline().parameters.filesnamesreceived
Use variable to hold the current item and use IfCondition to check if filename and folder names match.
Note: Try to evaluate dropping the file extension as per your requirement as metadata would hold the complete file name along with
its extension.
If True - > the names match, copy from source to sink.
Here the hierarchy is preserved and you can also use "Prefix" to mention the file path as it copies with preserving hierarchy. It utilizes the service-side filter for Blob storage, which provides better performance than a wildcard filter.
The sub-path after the last "/" in prefix will be preserved. For example, you have source container/folder/subfolder/file.txt, and configure prefix as folder/sub, then the preserved file path is subfolder/file.txt. Which fits your scenario.
This copies files like /source/source/source.json to /sink/source/source.json
AzCopy is simplest solution for this than Data factory, dry run can be used to check which files/folders will be copied
az storage blob copy start \
--destination-container destContainer \
--destination-blob myBlob \
--source-account-name mySourceAccount \
--source-account-key mySourceAccountKey \
--source-container myContainer \
--source-blob myBlob
I need to access a local JSON file. Since Grails 2.4 implements the AssetPipeline plugin by default, I saved my local JSON file at:
/grails-app/assets/javascript/vendor/me/json/local.json
Now what I need is to generate a URL to this JSON file, to be used as a function parameter on my JavaScript's $.getJSON() . I've tried using:
var URL.local = ""${ raw(asset.assetPath(src: "local.json")) }";
but it generates an invalid link:
console.log(URL.local);
// prints /project/assets/local.json
// instead of /project/assets/vendor/me/json/local.json
I also encountered the same scenario with images that are handled by AssetPipeline1.9.9— that are supposed to be inserted dynamically on the page. How can I generate the URL pointing this resource? I know, I can always provide a static String for the URL, but it seems there would be a more proper solution.
EDIT
I was asked if I could move the local JSON file directly under the assets/javascript root directory instead of placing it under a subdirectory to for an easier solution. I prefer not to, for organization purposes.
Have you tried asset.assetPath(src: "/me/json/local.json")
The assets plugin looks in all of the immediate children of assets/. Your local.json file would need to be placed in /project/assets/foo/ for your current code to pick it up.
Check out the relevant documentation here which contains an example.
The first level deep within the assets folder is simply used for organization purposes and can contain folders of any name you wish. File types also don't need to be in any specific folder. These folders are omitted from the URL mappings and relative path calculations.
I want to generate documentation for my lua project
but with Ldoc i generate docs for each single lua file and the output file every time overwrite the index.html file .
So my question is how i can generate generate documentation for the whole project with index page that has link to the all pages.
I tried to do that with see tag but i don't know if i can use it to reference to another file not another part in the document
I used this:
ldoc.lua.bat pathtomyproject/filename.lua
The output is the default path myluainstallationpath/doc/index.html.
Try ldoc.lua.bat pathtomyproject instead. This will generate the docs for all the files in pathtomyproject and will generate an index.html that links to each file used in that folder..
I'm sharing a configuration yml file client side, that I need to also load on the server side, I've placed it inside app/assets/javascripts/configuration.yml
I can use #{asset_path 'configuration.yml'} inside a view to get the path, but I can't inside a controller. I could access directly using "#{Rails.root}/app/assets/javascripts/configuration.yml" but when deploying the filename gets the digest string appended.
How can I get the same path from a controller?
ActionController::Base.helpers.asset_path("configuration.yml")
Might also be good to put configuration.yml in a different folder to separate javascript from non-javascript files.
I tried to follow the example under "Shared Templates" here:
http://grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.2.3%20Views%20and%20Templates
But this just plain didn't work. The tag I used was:
<g:render template="/includes/mySearch"></g:render>
I created a directory under the views called "includes" and created a gsp file, with a very basic form in it, named mySearch.gsp.
However, grails reported being unable to find the file:
java.io.FileNotFoundException: C:\springsource\sts-2.8.1.RELEASE\grails-1.3.7\src\grails\templates\scaffolding_mySearch.gsp
According to the documentation: "In this case you can place them in the root views directory at grails-app/views or any subdirectory below that location and then with the template attribute use a / before the template name to indicate the relative template path."
It would appear that this is exactly what I did, but grails was not looking there? Any advice?
Many thanks,
Alexx
Template files need to be starting with an underscore. Therefore you need to rename your mySearch.gsp to _mySearch.gsp.