Why are pages generated into folders? - eleventy

I am wondering why after running 'build' my nunjucks pages (other than index.njk) are getting output into separate folders? For example, if I have a file 'src/products.njk', it will be output to 'dist/products/index.html'.
For example
src
|-- index.njk
|-- products.njk
dist
|-- index.html
|-- products
|-- index.html
If there is an advantage to this type of renaming could you explain it to me?
Can this be overriden so that the file remains in the same output folder as 'dist/products.html'? Or is that an unwise thing to do?

Because it is seen as modern best-practice to not make users go to /products.html, but let /products be sufficient.
This also allows for easier migrations to a different stack, as you are not tied into one filetype.
See what the W3c says about URL styling here, and also what the Eleventy docs have to say for more info.

Related

Can you create URLs for files in sphinx regardless of where they are saved?

Can you change the location of 'rst' files in sphinx without changing their URIs? I'm working on a documentation where we want to move some files to different folders, without changing the URIs:
For Example: If you create a sphinx project with $ sphinx-quickstart and add some files and folders:
index.rst
/tutorials/howToFoo.rst
/scripts/
With the toctree in in index.rst looking like that:
.. toctree::
:maxdepth: 1
:caption: Processing:
:glob:
scripts/*
tutorials/*
Then after building the project with make html, you have a link in your browser as seen here: tutorials/howToFoo.html
If you want to save the the file in a different folder:
index.rst
/tutorials/
/scripts/howToFoo.rst
Then the URL of your file howToFoo.rst changes depending on where it is saved:
scripts/howToFoo.html.
This is a problem because I don't want links to tutorials or scripts to break.
As the project aims to include many people, it will be very probable that there will be changes in the file structure in the future.
Now my question: Can you create a setup where you can move the files without having to write redirects to their new location, every time you move them?
For Cross Referencing inside of Sphinx this is solved for example with targets, explained here:
https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html#automatically-label-sections
But this doesn't help me because the link in the browser still stays the same.
What I want is a link SomeNeverchangingLinkFor_howToFoo.html regardless of where the file howToFoo.rst is saved.

Grails assets directory management

To my Grails project, I use ztree library.
In the css of this library, we have the following :
background-image:url("/ztree/img/zTreeStandard.png")
I have 3 directory in assets/
images/
javascripts/
stylesheets/
I don't want to modify the css to change the path of background-image:url("/ztree/img/zTreeStandard.png").
So, here are my questions :
Is that mandatory to create a ztree directory in assets/ ?
Can I put ztree directory in images/ ?
Thanks,
If you store the image at grails-app/assets/images/ztree/img/zTreeStandard.png, the assets-pipeline plugin should be able to resolve it (I haven't tested this). If it doesn't work, the reason will be because of the leading / in the path
background-image:url("/ztree/img/zTreeStandard.png")
I understand that you don't like modifying 3rd party code, but I don't think you'll have any choice other than to change this to
background-image:url("ztree/img/zTreeStandard.png")
I would recommend creating a assets/vendor directory and you can just dump all your third-party libraries in there. It should be smart enough for you not have to change any paths--though the absolute URLs might mess things up since usually grails is running at http://host:port/app-name/.

Directory Structure for Yeoman apps

With the lastest yeoman update, 1.0, are we able to change the way a directory structure is created? ex...If I want to create my files within the root directory instead of the '/app' folder, is this possible? Also, if we want to name our assets folders 'css', 'js' or 'img', can this be achieved?
I make reference to this previous question for an update.
Thanks
Yes, everything is now contained inside the Gruntfile.js. You are free to change whatever you want. We have defined a couple of shortcuts at the top for quickly changing the app and dist directory.
Check out the grunt docs on how to go about doing that.

Why does Jekyll create new directories with index.html files in them when I create a new post?

Am I missing a setting somewhere? When the site is generated, the markdown files in the _posts directory get converted to directories themselves. Each of those directories has an index.html file in it with the content.
I would obviously just prefer for the posts to be generated without creating a new directory for each post.
This has to do with the way you are configuring permalinks to have pretty permalinks. If you want don't want pretty permalinks and you just want to have .html files on their own and not in their own directories, in your _config.yml file try changing
permalink: pretty
to
permalink: date
or
permalink: none
What's the problem with the directories? If you don't want your posts to end .html (which I assume that you don't) then surely you need to use the directory/index.html for it reliably to work without dependence on the particulars of a given webserver. Directories are cheap. You may as well make use of them - it's not like you're rooting through the _site directory manually.

How do I generate docs for a set of applications in Erlang?

My question
How do I generate OTP-like documentation for multiple applications?
Explanation
I have developed an application library following the OTP structure, and I'm using rebar to compile the code.
An example of my directory structure is shown below:
lib/
apps/
application_1/
include/
src/
application_2/
include/
src/
...
rebar.config
rebar
My rebar.config file looks like the one below:
{sub_dirs, ["apps/application_1",
"apps/application_2",
...]}.
When I run rebar doc, the documentation is generated and stored in the doc folder inside each application directory, but I want to generate a documentation that understands the library folder as one single unit. In other words, I want to create an index page automatically, just like the Erlang documentation.
I tried understanding erl_docgen, but to no avail. Is there a way to do this?
In the case of OTP, the documentation you find at http://erlang.org/doc seems to be generated using a bunch of HTML templates, scripts and Makefiles. See:
https://github.com/erlang/otp/tree/maint/system/doc/top
You might want to use that as an "inspiration" for your own documentation top pages.
I'm not sure if rebar can create a documentation index for all the Erlang applications contained in an Erlang release, but I doubt it.
medoc (for multiple-edoc), is a rebar3 plugin I wrote that will put all the docs into the same top level doc directory.

Resources