Jekyll categories not working for the address link - jekyll

I learned from Jekyll that I can put a category tab in my markdown file. And the address of that post should be homepage/category/filename.
For example, if my markdown file has a category:work, and my post title is hello-work, my post link should be something like localhost/work/hello-work.
But somehow this trick does not work for me. I am still getting address like localhost/post/hello-work.
I also tried to create another folder structure like work/_posts/hello-work.md, it also does not work for me. The email address is always localhost/post/hello-work.
Any idea about where possible goes wrong?

Related

How do I link src (HTML) from a host and not from a directory in VSCode?

I'm having trouble with previewing images and such in VSCode, which limits my ability to edit HTML properly in VSCode.
So instead of writing an entire URL, can I just "link" the DNS as a folder?
For example, instead of writing something like
src="www.site.com/file/pic.jpg"
Can I just write something like
src=file/pic.jpg
with any specific command in between? like a ref?
I've tried something like but I really haven't figured it out yet.

Default localized index.html for pelican

I tried to find something that is similar to my problem, but I did not have success.
I'm using pelican to build a static multilanguage website and I'll use github pages to publish the content.
Being a multilanguage site (en as default) I decided to structure the output folder with separated folder for each language and use relative url to point to templates etc.. all works smoothly enough.
Just to make a first github page publish experience I used ghp-import and again all is working properly except for one little thing.
Also in localhost:8000 the default homepage, all the other pages, etc have the language tag in the url, like:
localhost:8000/en/blog
localhost:8000/it/blog
the problem is that the default homepage is:
localhost:8000 (for localhost obviously)
username.github.io (for github pages)
by landing on this page, the templates fails to load (again they are lang specific) and ever worst, all the link are broken because they do not point to any language (localhost:8000/blog does not exist)
What I would like to do is to make a redirection so that, when typing username.github.io will redirect to username.github.io/en
I did not find something suitable in the pelicanconf.py file..
is it possible?
Thanks!
Try changing your SITEURL in pelicanconf to 'username.github.io/en'
That should work but the address 'username.github.io' won't work anymore.

Searching the file's directory instead of putting the exact file location

For a programming course we are to create a basic webpage login that redirects to a homepage. (Note: We are not required to create a database.)
The code works but I want to change that by searching the directory of the same folder of the html. The loginwebpage.html is also located in the same directory as index.html. I want it to search only the directory so regardless of where the folder is located it will still find the index.html instead of searching for it in a specific location.
<form name="f1" method="post" action="file:///C:\Users\n\Downloads\s\our webpage\index.html" id="f1">
I'm not sure exactly what it is you are asking because it looks like 2 different questions. Are you just wanting to redirect to a different webpage or to something else?

A static blog generator with multiple image directories

Question: what software should I use to achieve a static site generator like described below?
I'm looking for a static blog generator, which... generates static blogs, of course :). However I need something more, like a nice set of themes to choose from, and, what is even more important, a specific way of managing assets.
When I write articles/posts/text, I create a new directory. Then inside I have a file like article.md, or article.textile. I also have files with code, and pictures, and charts etc. Everything is inside this one directory. Then I used to run a tool to convert it to html, and copy the html to a website for publishing. However there was always a problem with images. I had to copy the images somewhere e.g. to Wordpress and then change the image urls in the html. This is not the best way to do it.
I'd like to have a static blog generator, which would let me keep my normal structure: one directory per post, and keep all the images from the directory in generated structure, so I can have relative paths to the images.
I really don't like the idea to keep all articles in one global directory, and all images in another global one.
I've checked jekyll, and pelican so far, and read about couple others, but I haven't found any solution to that problem. I know that, as usually, you will have many nice ideas to check.
And of course I know that most probably this post will be "closed and not constructive", or with any other funny explanation, but maybe someone will manage to post any solution before that.
Hugo can do this. cd to empty folder of your choice, then
create the scaffolding:
hugo new site .
After that you can put your content in content, example:
content
post
alpha
index.md
1.jpg
2.jpg
bravo
index.md
1.jpg
2.jpg
Build site:
hugo
Result is generated in public folder:
public
post
alpha
index.html
1.jpg
2.jpg
bravo
index.html
1.jpg
2.jpg
Jekyll does not explicitly enforce a rule about where to put your assets like images with the exception that Jekyll will not copy files directly in a folder beginning with an underscore. Although the general practice would be to put all images in the \assets\ directory, you can put it anywhere else other than the _posts\ directory, which is what you wanted.
This is the default behavior, but there are ways to get around this:
Have your posts live outside the _posts directory
Put all your posts outside the default _posts folder along with the images (this will copy all the files without any YAML frontmatter, and preprocess all the files with the YAML frontmatter). However, any other function you can do with posts automatically in Jekyll won't work anymore. This may or may not be an issue.
Plugins
Here's a plugin (link to SO question) written specifically for making Jekyll copy files in the post directory. If you do use this you can definitely just write the following Markdown and it'll link relative to the post as it should. :
![Image title](my_image_filename.png)
Jekyll asset path plugin is another robust plugin that does something similar, but does not keep your images in one directory, it does however link images relative to your post title though.
Jekyll asset pipeline is another another plugin that handles CSS and JS, which might be something you want to have in conjunction with plugin 1.
Do note however that the use of third party plugins is not supported with GitHub Pages site generation, meaning you will have to generate them in another branch or locally, and then pushing the static HTML files to master. This might be an issue for you if you're planning to host with GitHub Pages, else on your own server instance you're good to go.
I also want my posts to be "self contained", text content and image assets being in one single folder. I'm using Jekyll.
I have made this possible with a Pull Request on the great jekyll-picture plugin.
I can then use the simple {% picture my-image.png %} syntax to show the image in my post that is in the same folder.
Here is an example: https://github.com/nhoizey/nicolas-hoizey.com/tree/master/_posts/2015/06/19-mon-jeu-esviji-integre-a-framagames
One year after my previous answer, I have now developed a Jekyll plugin that helps keep posts assets alongside the Markdown file, it might fill your needs: https://nhoizey.github.io/jekyll_post_files/

How do you create a sub-directory for a website?

I am likely just not searching this the right way, but I have no idea how to add a sub directory to a website, you know www.websitename/HOWDOIADDTHISPART
I have my index.html set up but now I want to add pages and have made some with html but not sure how to link to them, my index.html works with www.websitename/index.html so i figured i could link the html name but it doesn't do anything. (i get 404 not found of course)
as I said i have been looking, for over an hour, it seems like an easy enough thing, it is pretty essential to any website, but I just can't find an answer. I would really appreciate anything, a link, correction of wording, whatever.
If you upload the other HTML pages in the same folder you can reach them with www.your site.com/page name.HTML
If in the index.HTML folder you create a subfolder and a file in that subfolder you can reach the page with www.yoursite.com/subfoldername/pagename.HTML