Hugo site, deployed to public/ directory in html, gives weird results - html

I have a Hugo site with lots of folders and subfolders, containing both _index.md files and many others. It uses the docsy theme.
Running hugo server displays the site correctly in the browser at localhost:1313
When I run hugo or hugo -D to get the same pages as HTML files on the disk, and I get
a set of folders...
... containing only index.html and index.xml files,
but no other files. All the other files are missing.
links look like the raw .md file (example: [VPAT](https://docs.axway.com/bundle/AccessibilityVPATS_allOS_en_HTML5/page/Content/accessibility.htm)
The index.html files are unstyled, unlike the pages generated by the hugo server command.
I don't see how to use the index.xml files.
Here is an example of the files and folders produced by the hugo command:
public/
index.html
index.xml
docs/
index.html
index.xml
admin_intro/
index.html
index.xml
troubleshooting/
index.html
index.xml
...
Here is what the .md file structure looks like
content/
en/
_index.html
search.md
docs/
_index.md
admin_intro/
_index.md
amdin_page_1.md
amdin_page_2.md
amdin_page_3.md
troubleshooting/
_index.md
ts_page_1.md
ts_page_2.md
ts_page_3.md
...

It looks like maybe your postcss process isn't running correctly. I had this problem after upgrading Hugo and Docsy
The postcss process isn't used in the dev mod (hugo server) but it is in production (hugo) so you will unfortunately get different results.
Try running hugo locally with the --debug flag and see if any errors show up.

Related

I can't edit Jekyll index.html

I'm trying to change /_site/about in index.html. When I edit the index.html and start jekyll, index.html back to it's original content.
Sorry for my english.Thank you very much for your help.
You don't edit files inside the /_site directory. When jekyll builds the site, it overwrites any and all files in that directory.
Edit the index.html file in the /about/ directory outside of the /_site/ folder.
Run the command jekyll build to apply these changes to the generated site.
Or use jekyll serve to automatically host the content locally and update the content when a change is made.
There's no need to edit Index.html file as it is generated from the markdown file your provided which as we all know is called index.md, whenever you change that file and run jekyll build it re-generates the index.html file hence if you edit once you would have to do the same again when you change index.md file.
So directly write html / markdown in index.md file in your jekyll directory.
Best,
Daksh

Jekyll Wiping My Directory

I followed the instructions for Jekyll Quickstart. Whenever I make changes in my site's directory, the changes get wiped somehow. For example, I modified some of the code in index.html, only to have it return to Jekyll's default. I also created a subdirectory in _site called 'otherservices' with an index.html. That gets wiped as well. Any idea why this may be happening? I can't really use Jekyll if it keeps wiping.
Jekyll is a static website generator, each time it generates a website it place files in the _site folder.
Any changes you make inside the above folder are lost because it is recreated when executing jekyll build or jekyll serve .
Changes should be made to the rest of the files or folders so they will be processed and locate the resulting files inside _site.
You should not write manually into _site directory, that is Jekyll's output.
If you need an otherservices directory in the output, place it one level above, like this:
_site/
otherservices/
index.html
index.md
Jekyll will copy every file and directory into _site, which is not excluded in the configuration and doesn't start with _ prefix. Files that have front-matter will be processed in addition to copying. So in result Jekyll will generate this structure:
_site/
otherservices/ (copies it)
index.html
index.html (generates it from index.md)
otherservices/
index.html
index.md
It is worth reading the documentation on how to create custom pages.

Jekyll blog shows 404 error

I created a simple jekyll site as https://github.com/nagachinta/nagachinta.github.io, but throws 404 error. I observed the git commits I made and the commits in the git says.
" A file was included in about.md that is a symlink , doesnot exist in your '_includes', directory."
The file is not a symlink, it's just a real file.
The index files , etc are real files not symlinks.
You're using Jekyll 3.2 locally. This means that you're now using gem based themes. No more _includes, _layouts and _sass folder when you do your jekyll new.
On the other side github pages uses Jekyll 3.1.6 (reference).
So when you pull a site created without _includes, _layouts and _sass folders on github pages, it results in build errors. Your site is not created and you get 404s errors.
If you want to be sure that a site developed locally to work on github pages, you can go with gh-pages gems. See install instructions here.
If you just want to stay with jekyll 3.2 locally and copy themes's files, you can have a look at this answer.

Jekyll generates empty files

I recently pulled a copy of my github pages site to a new Windows machine and when I run jekyll all the files get created in _site but any that use a layout are empty.
I have tried jekyll build --layouts C:\Path\to\site\_layouts which still resulted in empty files.
Its compiling SASS no problem and copying the files with no front matter. Its generating empty files for all the posts and drafts so its seeing _posts and _drafts which makes me think it should be able to see _layouts but its not...
anyone come across this issue?

How can I setup Jekyll for a blog with a large image directory, so as to avoid duplicating that directory in the generated site?

I'm considering Jekyll for a site I'm putting together that will be a blog with lots of images (and other larg-ish media files). It's easy enough to to make a directory for images and then link to them as needed in the posts. But, as I understand it, when the site is generated, all the image data will be duplicated into the generated _site directory that holds the static files. Each time the site is generated the _site directory is emptied, and repopulated with the static version of the site.
Is there any way to, for example, drop a symlink to the images directory inside the site directory, and then maybe have jekyll ignore it when the static files are generated?
Or is there another way to go about this that makes more sense?
Assuming you are running on an apache web server, you can setup an Alias directive to serve images from a directory outside of the normal docroot. You need access to edit the VirtualHosts config or some other ability to create aliases directives (e.g. via a control panel).
For an example of how this would work, let's say you are storing your jekyll files under a directory called "/web/jekyll". To get your images directory do the following:
Add an "_images" directory along with your basic jekyll tree. Ending up with something like:
_config.yml
_images/
_layouts/
_posts/
_site/
index.md
Update your apache config to add the Alias directive like:
Alias /images /web/jekyll/_images
Reload the apache config and run jekyll to build the site.
Since the image directory name starts with an underscore, jekyll won't push/copy it to the output _site during the build. Apache will happily serve most files from your _site directory as normal, but when it sees something like "http://jekyll/images/test.jpg", instead of looking for the file under "/web/jekyll/_site/_images/test.jpg", it'll serve it from "/web/jekyll/_images/test.jpg".
Incidentally, I like a little more separation of the source content and output content than jekyll defaults to. So, I setup my directory structure as follows:
/web/jekyll/html/
/web/jekyll/images/
/web/jekyll/source/
/web/jekyll/source/_config.yml
/web/jekyll/source/_layouts
/web/jekyll/source/_posts
/web/jekyll/source/index.md
With the following option set in _config.yml
destination: ../html
And the apache alias directive setup with:
Alias /images /web/jekyll/images
Jekyll is run in the "/web/jekyll/source" directory, but output is sent to the "/web/jekyll/html" dir. Similar to the first example, calls to "http://jekyll/images/test.jpg" are served from "/web/jekyll/images/test.jpg". This setup doesn't really make a difference from a site serving perspective. I just like the cleaner separation between the raw source files, the fully baked output files and the images which work via the alias.
Correct, the first part of the jekyll command removes everything in the destination directory. The problem with that is the symlinks must be manually created again. So next, go ahead and create a script that does this each time.
Be sure that:
exclude: [jekyll, css, img] in the _config.yml file
linux: The ";" symbol runs first, second, third.. commands.
script: A file named jekyll with executable permissions containing
jekyll;
ln -s /var/www/css /var/www/_site/css;
ln -s /var/www/img /var/www/_site/img;
Finally run (./jekyll) that program instead of jekyll.
-Dan
Make a project page for the images.
Set up directory structure
/home/git/svnpenn.github.io
/home/git/img
Run Jekyll
# We cant add the symlink until after jekyll is done. We will remove the
# site folder and wait for it to rebuild.
rm -r _site
jekyll --server &
while [ ! -f _site/index.html ]
do
sleep 1
done
ln -s ../images _site/images
Note I was using this because I thought it would help publish time on GitHub
pages. It does not. GitHub can take 1-10 minutes to publish depending on the
server.
I know this has already been answered, but I went a slightly different route. I hosted all of my images in a public directory on Dropbox and use grunt to generate a manifest of the images. It keeps my repository small because the images don't get checked in. I detailed it a while back in a blog post.