Skip to content

Commit

Permalink
Move settings from config.rb to settings.ml
Browse files Browse the repository at this point in the history
  • Loading branch information
5t111111 committed Dec 30, 2015
1 parent 198ddfd commit 6ea681e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 51 deletions.
37 changes: 6 additions & 31 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,36 +138,11 @@

Dir.glob(File.join("#{root}", "node_modules", "*", "fonts", "*")) do |file|
asset_path = Pathname.new(file).relative_path_from(Pathname.new(File.join(root, "node_modules")))
sprockets.import_asset asset_path do |path|
org_path = Pathname.new(path)
"fonts/#{org_path.basename}"
end
p asset_path
sprockets.append_path File.join "#{root}", "node_modules", File.dirname(asset_path)
# sprockets.import_asset asset_path do |path|
# org_path = Pathname.new(path)
# "fonts/#{org_path.basename}"
# end
end
end

###
# Site Settings
###

# set site URL
set :site_url, 'http://blog.example.com'
# set site title
set :site_title, 'Drops Template'
# set site description (only used for meta description for the moment)
set :site_description, 'Site Description'
# set site author name
set :site_author, 'Site Author'
# set site author profile information
set :site_author_profile, 'Lorem ipsum dolor sit amet, cu facilis indoctum interpretaris has. Ius ea quod euismod fierent, per in legere gubergren accommodare, ut labitur partiendo urbanitas duo. Tamquam inciderint at sed. Per at nibh graecis intellegebat. Probo brute ancillae sit ex, tota recusabo disputando usu et.'
# set site author profile image (should be in images_dir)
set :site_author_image, 'profile.png'
# when true, the page and site titles will be reversed (page title | site title)
set :reverse_title, true
# twitter/facebook/github/linkedin links in author page (otherwise set nil)
set :social_links,
twitter: 'https://twitter.com',
facebook: 'https://facebook.com',
github: 'https://github.com/5t111111',
linkedin: 'https://linkedin.com'
# set Google Analytics account, like "XX-12345678-9"
# set :google_analytics_account, 'XX-12345678-9'
13 changes: 13 additions & 0 deletions data/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
site_url: 'http://blog.example.com'
site_title: 'Drops Template'
site_description: 'Site Description'
site_author: 'Site Author'
site_author_profile: 'Lorem ipsum dolor sit amet, cu facilis indoctum interpretaris has. Ius ea quod euismod fierent, per in legere gubergren accommodare, ut labitur partiendo urbanitas duo. Tamquam inciderint at sed. Per at nibh graecis intellegebat. Probo brute ancillae sit ex, tota recusabo disputando usu et.'
site_author_image: 'profile.png'
reverse_title: true
social_links:
twitter: 'https://twitter.com'
facebook: 'https://facebook.com'
github: 'https://github.com/5t111111'
linkedin: 'https://linkedin.com'
# google_analytics_account: 'XX-12345678-9'
21 changes: 11 additions & 10 deletions helpers/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def format_date(date)
end

def site_title_logo
site_title_logo_image
data.settings.site_title_logo_image
rescue NameError
nil
end
Expand All @@ -13,22 +13,23 @@ def title(title)
end

def format_title
p data.settings
separator = ' | '
if reverse_title
if data.settings.reverse_title
if current_article
current_article.title + separator + site_title
current_article.title + separator + data.settings.site_title
elsif @page_title
@page_title + separator + site_title
@page_title + separator + data.settings.site_title
else
site_title
data.settings.site_title
end
else
if current_article
site_title + separator + current_article.title
data.settings.site_title + separator + current_article.title
elsif @page_title
site_title + separator + @page_title
data.settings.site_title + separator + @page_title
else
site_title
data.settings.site_title
end
end
end
Expand All @@ -37,9 +38,9 @@ def page_description
if current_article && current_article.summary(100)
description = current_article.summary
elsif @page_title
description = @page_title + ' page of ' + site_title
description = @page_title + ' page of ' + data.settings.site_title
else
description = site_description
description = data.settings.site_description
end
# remove html tags
description.gsub(/<("[^"]*"|'[^']*'|[^'">])*>/, '').gsub(/[\r\n]/, ' ')
Expand Down
6 changes: 3 additions & 3 deletions source/author.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
h1
| Author
h3
= site_author
= data.settings.site_author
p
= site_author_profile
= data.settings.site_author_profile
.social-wrapper
ul
- social_links.each do |name, url|
- data.settings.social_links.each do |name, url|
- if url
li
a href="#{url}"
Expand Down
6 changes: 3 additions & 3 deletions source/partials/_footer.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.author
.image-wrapper
a href="/author/"
img src="/#{images_dir}/#{site_author_image}" alt="author"
img src="/images/#{data.settings.site_author_image}" alt="author"
.copyright
i.fa.fa-copyright
= ' '
= Time.now.year
= ' '
= link_to "#{site_title}", "/"
= link_to "#{data.settings.site_title}", "/"
| -
= site_author
= data.settings.site_author
8 changes: 4 additions & 4 deletions source/partials/_header.slim
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
a href="/feed.xml"
i.fa.fa-rss-square
h1.logo
a href="/" title="#{site_title}"
- if site_title_logo
img src="/#{images_dir}/#{site_title_logo_image}" alt="title-logo"
a href="/" title="#{data.settings.site_title}"
- if data.settings.site_title_logo
img src="/#{images_dir}/#{data.settings.site_title_logo_image}" alt="title-logo"
- else
span.logo-text
= site_title
= data.settings.site_title

0 comments on commit 6ea681e

Please sign in to comment.