I have categories with spaces in them. I add them in a post as follows:
layout: post
title: "Visualizing the Magnitude of Earthquakes in New Zealand"
date: 2012-11-06 19:19:41 -0800
categories: [Data Visualization with R]
comments: true
Octopress correctly generates the path data-visualization-with-r and when I go to mysite.com/categories/data-visualization-with-r all is well.
However, on the automatically generated 'categories' page the link is to:
mysite.com/categories/data%20visualization%20with%20r/
which is empty.
Does anybody have experience in categories with spaces in them?
Edit: I will add that the link to the category from the main blog page is also correct. The only place where it has spaces and is wrong/different is on the /categories page.
how is it automatically generating the categories page? you can use slugify http://jekyllrb.com/docs/templates/
{{ page.categories | slugify }}
Related
the problem:
we are porting a wordpress blog to lektor. The slugs in wordpress of the post are directly under the main domain e.g. www.mypage.com/my-blogpost-about-food/ not www.mypage.com/blog/my-blogpost-about-food/.
Now the owner is not ready to accept any broken links. Broken links from the outside, e.g. some random internet page links to www.mypage.com/my-blogpost-about-food/. This link will not work in lektor. This will decrease the page rank of the redesign of the page with lektor. What can I do to avoid this?
Again, in our current wordpress website
the main blog page sits under:
www.mypage.com/blog/
each blog post has a unique slug, NOT under /blog/ but directly in the main.
e.g.
www.mypage.com/my-blogpost-about-food/
What can I do, to make these URLs be valid for lektor as well? that e.g. mypage.com/my-blogpost-about-food is a blog post.
EDIT: this is what lektor does not support. Blog posts in lektor must sit in www.mypage.com/blog/SINGLE-BLOG-POSTS-MUSTBEHERE but I want the blog posts to be here www.mypage.com/SINGLE-BLOG-POSTS-MUSTBEHERE
reading here
https://www.getlektor.com/docs/content/urls/
if I go to the system fields and enter my-blogpost-about-food it will still appear in /blog/my-blogpost-about-food/
reading here it becomes clear that I cannot change the slug in the parent model neither:
With the above settings the blog will live at blog/ and the posts at
blog/. But what if you want to put the date of the blog
post into the URL? That's thankfully very easy. All you need to do is
to set up a new URL format for the children. Just edit blog.ini and
add this to the [children] section:
slug_format = {{ (this.pub_date|dateformat('YYYY/M/') if this.pub_date) ~ this._id }}
What this does is that it will prepend the year (YYYY) and month (M)
to the ID of the page if the publication date is configured. Otherwise
it will just use the ID of the page. With this change our blog post
will move from for instance blog/hello/ to blog/2015/12/hello/.
now how would I achieve a behaviour similar to this?
this is the formal of the perma links of our wordpress installation:
This is possible. If you started with the default setup from lektor quickstart:
In models/blog-post.ini, remove hidden = yes
In models/blog.ini, under the pagination section, add items = site.query('/').filter(F._model == 'blog-post')
The first step lets you create blog posts under root in the admin.
The second step tells the page blog to look for its pagination items under /, and only include the ones of type blog-post. This will exclude e.g. About, Blog, etc.
You will now have your site's home page at /, a blog page with list of all posts at /blog, and each post will be located at example.com/my-blogpost-about-food/.
To create a new blog post in the admin, go to the root admin page (not the /blog admin page), click the +, and select Blog Post for your new page type. It will show up in the list on /blog, and live directly under /.
I'm not certain I understand exactly what you want to achieve. If I understand correctly you can possibly solve this using the replaced_with for children functionality:
https://www.getlektor.com/docs/guides/categories/
I'm using Fishpig to pull in blog posts from WordPress and everything is working fine. However, on /blog instead of having the blog posts displayed in their full length I'd like to use excerpts from the posts (similar to WordPress's method of showing posts in archive/category/ect).
I found default.phtml under app/design/frontend/base/default/template/wordpress/post/list/renderer/default.phtml and see that on line 21 is <?php echo $post->getPostExcerpt() ?>
When commenting this out the content from the posts on /blog no longer shows, indicating I'm in the right file. I really wish I could just use get_excerpt(); here. How/what do I modify to pull in an excerpt instead so the blog pages listing posts don't just pull in the entirety of each post?
To show an excerpt, you have 3 different options:
1) Go to your post in the WordPress Admin and manually enter a post excerpt in the post excerpt field. This field is located just below the post content field. If this isn't visible, click the 'Screen Options' tab at the top of the page and enable the post excerpt field.
2) Go to your post in the WordPress Admin and use the More tag/button to split the post. Every thing before the More tag will be used as the post excerpt. You can find out more about the More tag at the following URL:
http://en.support.wordpress.com/splitting-content/more-tag/
3) Open the list template (wordpress/post/list/renderer/default.phtml) and add some PHP code to shorten the post content.
Copy the default.phtml file from /base/default/template/wordpress/post/list/renderer/ in to your theme with same folder structure. Then comment the lines that cause for post description and add below code.
$content = $post->getPostExcerpt();
$content = strip_tags($content);
echo substr($content, 0, 250);
I am trying to escaladate a problem with Octopress.
By analysing my blog with a SEO tool, I note that a "/" is missing (between blog and categories):
http://www.myblog.com/blogcategories/linux
I also note that, in the octopress/public/categories folder, for each category of my blog, one folder is created with one index.html file, i.e:
octopress/public/categories/linux/index.html
On the 22rd line, I see:
<link rel="canonical" href="http://myblog.com/blogcategories/linux">
which is the source of my problem.
I would like to know which module in Octopress generates this file and what could be my mistake ?
I declared in _config.yml the following parameter:
category_dir: categories
I'm not sure if this completely solves your problem, but I found this site with lots of octopress hacks. There is a section about categories in the sidebar: http://www.narga.net/improve-octopress-advanced-tweaks-tips/
Sidebar category list
This plugin provides the category list and post count shown in the sidebar.
Save tag_cloud.rb to plugins/tag_cloud.rb.
Save category_list.html to source/_includes/custom/asides/category_list.html.
Append to default_asides in _config.yml:
Add to _config.yml: default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html, custom/asides/category_list.html]
On all my Joomla pages I have the articles title as the h1 tag, so until now, Joomla has always displayed the title, i.e. what you see on the browser tab as the h1 tag. (There were one and the same thing).
However, this is not the case with all the pages that have no menu item linking to them, (they are linked to the rest of the site through another article). Here the name of my site is the page title.
How do I make the h1 tag the page title on these pages?
Try this,
This is happen due to those article pages meta options have title, Meta tag and keywords those are blank or not set yet. Then this case Joomla will read those info from your Global settings It may have your site name and Global description.
So the solution is set the Proper meta info for those articles from article manager.
If it is not practical then you can try it from article view or layout page Set meta data of Joomla page
Second Method is for setting the page title forcefully from scripts. It used for any components like here you have to check first method it will work for you..
Hope its Helps..
Problem solved! Here is how:
Make an override of com_content article and edit the default.php. Around lines 42/43 you should have the following code (the line number may not be exact as I have already taken out some code for a previous override):
<?php if ($params->get('show_title') || $params->get('show_author')) : ?>
Straight after that, add the following lines of code:
<?php $document=& JFactory::getDocument();
$document->setTitle( $this->item->title ); ?>
Yes. I want to override output of Category Blog component to 2 different display styles.
For first style, i copied and edited blog_item.php & blog.php in [mytemplate]/html folder. Then i choose template style from dropdown in backend of my category blog. That's worked. The display of category blog change as i expected.
But if i want to create another style and use in another category blog. How could i do ? And how to i named my files ( I tried blog_1.php, blog_item_1.php ) but only see my first style display in backend.
I'm using joomla 2.5.
Please help me. Thank you very much !
=================================================================================
[UPDATED]
I solved this issue. Here my solution:
Clone my template to [my_template_2]
Go to [my_template_2]/html/com_content/category then edit blog.php, blog_item.php as my needs.
Go to backend, at my category blog menuitem, i assigned [my_template_2] as its template style.
Then it worked. Both my category blog have its own style.
This maybe not very good solution because i have to use multiple templates, but at this time it's quite enough for me.
Thank you, stackoverflowers.
=================================================================================
[UPDATED 2]
Now, with multiple template styles, I could create unlimited styles for my category blog component within just only one template. That's very much better.
As you may know, joomla doesn't let developers make different styles for its components.
I think you have to list all menus which are made by "category blog component" in template managing page and let users set each menu style at there.**
and at blog.php, check template setting and then load customized style...
** you have to develop a custom field element which list all "category blog component" menus.
* you can use this code to accessing template parameters in component's template :
$app =& JFactory::getApplication();
$template = $app->getTemplate(true);
$paramsTemplate = $template->params;
$style = $paramsTemplate->get('style');
You don't need to use multiple styles. What you need is to use alternate layouts and alternative menu layouts.
For alternative menu layouts in the html/componentname/category folder of your template make a new style with a unique set of names similar to the way blog already provides an alternative to category list in the article category layout folder. Also make a new xml file for each layout that you make, with a matching name.
When you create your menu item you will now get these alternatives along with your other normal choices. Just select the one you want.
Based on the learnings above here is my code for the /templates/mytheme/com_content/category/blog.php
And then in the Global Configuration > Article Manager Options > Category choose Blog as the override/ layout.
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers');
$pageclass_sfx = trim($this->pageclass_sfx);
// so pick it on the page class in menu item
if (isset($pageclass_sfx) && $pageclass_sfx != '') {
echo $this->loadTemplate($pageclass_sfx);
} else {
echo $this->loadTemplate('default');
}
I can add multiple elseif if something else is needed, or it will look for 'blog_' . $this->pageclass_sfx . 'php'. It is always beginning blog_ as thats coded into the com_content. The old blog i moved to blog_default.php and blog_default_item.php