
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Having a closer look at ruby based blogging platforms like serious and toto, I missed some functionality.
This a a collection of tools usable in both platforms.
It's a piece of cake: just use the gem
tool to get going with the blog_helper: sudo gem install blog_helper
If you want to use features that rely on accessing the http requests like the tag feature, you'll need to use the toto_prerelease.
Please follow the instrucions there to do so.
Piece of cake, again: all you have to do is use <% require 'blog_helper'%>
in your .rhtml or .erb file and call the corresponding methods.
For example, to use seo friendly titles, your layout.rhtml should be looking like this:
<!doctype html>
<html>
<head>
<% require 'blog_helper'
page_title = BlogHelper::seo_friendly_title(@path, title, 'yourSitesTitle.com')
%>
<title><%= page_title %></title>
<link rel="alternate" type="application/atom+xml" title="<%= page_title %> - feed" href="/index.xml" />
.
.
.
Adding the tagging feature requires the toto_prerelease as mentioned above, since we need the http request to apply our little hack.
To add a list of tags to your article, just use a custom yaml attribute:
title: The Wonderful Wizard of Oz
author: Lyman Frank Baum
date: 1900/05/17
tags: hacks, love, rock 'n' roll
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry,
who was a farmer, and Aunt Em, who was the farmer's wife.
Next, you need a place to show the tag links, for example the index.rhtml:
<section id="articles">
<% require 'blog_helper' %>
<% for article in articles[0...10] %>
<article class="post">
<header>
<h1><a href="<%= article.path %>"><%= article.title %></a></h1>
<span class="descr"><%= article.date %></span><% 10.times { %> <%}%>
<span class="tags">
<%= BlogHelper::tag_link_list(article[:tags]) %>
</span><% 10.times { %> <%}%>
.
.
.
And again: piece of caked ;-). Now all we need to add is a page that displays articles belonging to a ceratin tag:
Create a page called tagged.rhtml
in your templates/pages
directory that looks like this:
<%
require 'blog_helper'
desired_tag = BlogHelper::desired_tag(env["QUERY_STRING"])
%>
<h1>Posts filed under '<%= desired_tag %>': </h1>
<ul>
<% BlogHelper::desired_articles(@articles, desired_tag).each do |article| %>
<li>
<span class="descr"><a href="<%= article.path %>" alt="<%= article.title %>"><%= article.title %></a><br/></span>
</li>
<% end %>
</ul>
<br/>
Now, you did most likely implement a tag listing on your toto blog. Congrats!
To use a bit.ly shortened URL, just call the followin function inside a .rhtml file:
<%= BlogHelper::short_url_bitly(<url>, <bit.ly login name>, <bit.ly api key>) %>
Basically just adds the necessary java script to enable the disqus comment counter. For best performance, place it near the end of the page:
<%= BlogHelper::disqus_comment_count_js(@config[:disqus]) %>
</body>
</html>
Mind the usage of @config[:disqus]
, this enables configuration via config.ru
.
To access the comment count, use #disqus_thread
at the end of the permalink to the post & it will be replaced with the disqus comment count:
<a href="<%= article.path %>#disqus_thread"> </a>
Will result in the number of comments of the article the permalink posts to.
TBD... I have to refer to the source & ri for now.
FAQs
Unknown package
We found that blog_helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.