Move octopress blog to subfolder - octopress

I have currently my octopress blog up and running on my digital ocean droplet and everything works fine. But it is in the root folder of the droplet and I want to move it to a blog folder. Is that just moving all content to that subfolder, or is there more work to do to get this done to be aware of?

According to the Octopress documentation, if you are deploying in a subdirectory you'll need to update the following files:
_config.yml
config.rb
Rakefile
If you're deploying to a subdirectory on your site, or if you're using
Github's project pages, make sure you set up your urls correctly in
your configs. You can do this almost automatically:
rake set_root_dir[your/path]
# To go back to publishing to the document root
rake set_root_dir[/] Then update your _config.yml and Rakefile as follows:
# _config.yml
url: http://yoursite.com/your/path
# Rakefile (if deploying with rsync)
document_root = "~/yoursite.com/your/path"
To manually configure deployment to a subdirectory, you'll change _config.yml, > config.rb and Rakefile. Here's an example for deploying a site to the /awesome
subdirectory:
# _config.yml
destination: public/awesome
url: http://example.com/awesome
subscribe_rss: /awesome/atom.xml
root: /awesome
# config.rb - for Compass & Sass
http_path = "/awesome"
http_images_path = "/awesome/images"
http_fonts_path = "/awesome/fonts"
css_dir = "public/awesome/stylesheets"
# Rakefile
public_dir = "public/awesome"
# If deploying with rsync, update your Rakefile path
document_root = "~/yoursite.com/awesome"
source: http://octopress.org/docs/deploying/subdir/

Related

Remove ruby 3.1 autocomplete feature for heroku console [duplicate]

A follow up to Disable irb autocomplete
I would like to disable IRB on Heroku, e.g. having an .irbrc with:
IRB.conf[:USE_AUTOCOMPLETE] = false
In the home directory of my heroku dyno/server
How can I do it?
If you don't want to update the .irbrc on Heroku because that would affect others' usage of it, you can also disable autocomplete on Heroku just for yourself via the command line when you open it. The quotes are critical, or you will get a Thor::InvocationError:
heroku run "rails console -- --noautocomplete"
Your application's root directory ends up being the application's user's home directory at Heroku so you could put a .irbrc in your application's root directory. So add your .irbrc with IRB.conf[:USE_AUTOCOMPLETE] = false to your app's root directory so that it looks like this:
$ cd your_app_root_directory
$ ls -1A
.git/
...
.irbrc # <-----------------
...
Gemfile
Gemfile.lock
Procfile
README.md
Rakefile
app/
bin/
config/
config.ru
db/
...
Then, once you push everything up to Heroku, heroku run console will use that .irbrc.
Create an .irbrc file with this content:
IRB.conf[:USE_AUTOCOMPLETE] = false
IRB.conf[:PROMPT_MODE] = :SIMPLE

How to compile sass sourcemap in jekyll

I am using jekyll 3.4.0,
i am using sass for styling my website.
while compiling, it is won't create style.css.map file in _site folder, which very helpful for debugging.
My config.yml file
markdown: kramdown
port: 8080
sass:
sass_dir: css
sourcemap: true
style: compact
I don't think Jekyll (yet) supports SASS source maps.
For my projects I have added a SASS build step to my deploy script, which generates source map:
#!/bin/bash
# destination folder in which the build result will be stored
DEST="./_site/style"
# folder in which original SCSS files will be places
ORIGINALS=$DEST/originals
# folder in which include SCSS file will be places
INCLUDES=$ORIGINALS/_sass
# remove the previous version of the folder
rm $ORIGINALS -r
mkdir $ORIGINALS
# copy original SASS include files to output folder
cp ./_sass/ $ORIGINALS -r
# name of the entry point SCSS file (without the extension)
SASS_FILE=style
# copying the entry point SCSS file to the output folder
# (removing the frontmatter from the file)
tail -n +3 ./style/$SASS_FILE.scss > $ORIGINALS/$SASS_FILE.scss
# building the entry SCSS file
sass --load-path $INCLUDES --sourcemap=auto $ORIGINALS/$SASS_FILE.scss $DEST/$SASS_FILE.css
Important
Don't forget to configure your web server to server SCSS mime types.
Additional notes
The important thing here is that original SCSS files also get deployed to the web server, so that a browser can access them!
Also sourcemap parameter needs to be set to auto so that correct relative paths to original SCSS files get inserted into sourcemap.

How do I deploy octopress 3 to a subdirectory within an existing gh-pages site?

I am using Octopress 3, and when I run jekyll build, it generates the correct set of files (which includes my static files, see list of files below):
$ cd _site
:_site$ ls -a
. CNAME assets google2d8.html index-alternative.html
.. about blog increase-revenue.html index.html
Note that my entire jekyll-generated blog is now safely stored within \blog\, which is how I want it.
But once I do octopress deploy, it overwrites this entire folder (which also overwrites my existing static files), see listing below:
$ cd _site
:_site$ ls -a
. .. Gemfile Gemfile.lock about css feed.xml index.html jekyll
Here is my _config.yml:
title: My Title
email: some#email.com
description: > # this means to ignore newlines until "baseurl:"
some description
baseurl: "/blog" # the subpath of your site, e.g. /blog
url: "http://example.com" # the base hostname & protocol for your site
twitter_username: myusername
source: '../'
# Build settings
markdown: kramdown
theme: minima
This is my _deploy.yml
method: git # How do you want to deploy? git, rsync or s3.
site_dir: _site # Location of your static site files.
git_url: my_git_url
git_branch: gh-pages-2 # Git branch where static site files are commited
Note: Once I remove the following line from my _config.yml: source: '../', my jekyll build generates that deploy folder like octopress deploy does.
Given the new Octopress 3 and an existing static site hosted on my gh-pages branch, how do I deploy my blog to a subdirectory of that existing gh-pages site?
You're not setting the root dir correctly.
Follow this instruction:
http://octopress.org/docs/deploying/subdir/

Deploy path doesn't work for Git Deploy Method in middleman-deploy

I am using middleman-blog and middleman-deploy.
What I would like to do, is within the branch I am deploying to, I want the static files to be deployed to a subfolder within the repo (i.e. not the root folder).
I tried doing this in my config.rb:
activate :deploy do |deploy|
deploy.build_before = true
deploy.deploy_method = :git
deploy.branch = 'gh-pages-2'
deploy.remote = 'github'
deploy.path = 'blog'
end
But that doesn't work, it still deploys to the root directory. In fact, it doesn't even create the /blog folder I am looking for.
When I visit the config settings locally, these are the settings I see under :deploy:
:deploy
:branch = "gh-pages"
:build_before = true
:clean = false
:commit_message = nil
:deploy_method = :git
:flags = nil
:host = nil
:password = nil
:path = "blog"
:port = 22
:remote = "github"
:strategy = :force_push
:user = nil
This indicates to me that the path attribute is being set correctly.
I also tried doing deploy.path = '/blog' and that still doesn't work.
So how can I get this to deploy to \blog\ subfolder within my repo rather than the root directory?
The versions of the different gems are as follows:
middleman (4.1.10)
middleman-blog (4.0.1)
middleman-cli (4.1.10)
middleman-deploy (2.0.0.pre.alpha)
Note: I am purposely using gh-pages-2 because I don't want to overwrite my current gh-pages without being certain that it will deploy to the correct subfolder.
I think the easiest thing you could do is write an extension with an after build step: https://middlemanapp.com/advanced/custom-extensions/#after_build. That way you move the files during your build process and middleman-deploy just can push the whole build folder.
If the root of your site is also deployed on Github Pages you can create another repo called blog and deploy your middleman site there. Then by enabling GitHub Pages for the blog repo, you will actually have it deployed on yoursite.com/blog.
It is not the techiest solution you 'd expect but it works well for me

inconsistent asset precompiling Rails 4 and Heroku

Recently upgraded to Rails 4.0.2 from 3.2 on Heroku. I'm noticing that maybe every other push my stylesheet_link_tag and javascript_include_tag tags point to my development path (i.e. /assets/admin.css) instead of my production/precompiled # fingerprinted path such as /assets/admin-a334a2cf57ed6ffc29f7f7a1af35f380.css
here are the relevant setting from production.rb:
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
Because I am on Heroku I have config.assets.initialize_on_precompile = false in application.rb. So I always run bundle exec rake assets:precompile before deploying if I have made any changes to asset files.
Here is my folder hierarchy:
app
-assets
-images
-javascripts
-stylesheets
-themes
dark.css
blue.css
etc...
admin.css
application.css
jobboard.css
here is my application.config
config.assets.precompile += [
'admin.css',
'admin.js',
'jobboard.js',
'jobboard.css',
'themes/dark.css',
'themes/blue.css',
'themes/green.css',
'themes/plain.css',
'themes/seafoam-flat.css',
'themes/fire-flat.css'
]
But for some reason I get this inconsistent behavior in production. All files precompile. But sometimes the admin.css file is not referenced w/ the fingerprint, same for the css files under /themes. Any clue as to why this might happen?
If there's a missing precompile file maybe you should add them in config/application.rb
config.assets.precompile += %w( admin.css )
and then
RAILS_ENV=production bundle exec rake assets:precompile
You can check in the manifest ( public/assets ) for missing file or to see the fingerprint.

Resources