Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
avgaz

Обрезание текста в блоках

Recommended Posts

Собственно делаю блок вывода последних записей из Pages на главную страницу, делаю на основе уже имеющихся шаблонов и столкнулся с такой проблемой в шаблонах обрезается текст вот так вот

    <section class='ipsType_normal ipsType_richText ipsType_break ipsSpacer_bottom' data-ipsTruncate data-ipsTruncate-size='7 lines' data-ipsTruncate-type='remove'>
                    {$row->truncated()|raw}
                </section>

 

Где 7 lines это 7 строк и remove это удалить, для посетителей как бы все хорошо выглядит, а вот в исходном коде страницы текст не обрезанный, а полностью, то есть например если блок выводит последние 10 записей, то весь текст этих записей получается в исходном коде и соответственно поисковые системы все это видят и индексируют и такая страница для них выглядит как какой то спам.

Как можно сделать, что бы обрезалось полностью с не просто скрывалось по сути для посетителей??

 

Share this post


Link to post

Можно только сократить текст до определенного кол-ва символов

У метода truncated есть 2 параметра

	/**
	 * Text for use with data-ipsTruncate
	 * Returns the post with paragraphs turned into line breaks
	 *
	 * @param	bool		$oneLine	If TRUE, will use spaces instead of line breaks. Useful if using a single line display.
	 * @param	int|null	$length		If supplied, and $oneLine is set to TRUE, the returned content will be truncated to this length
	 * @return	string
	 * @note	For now we are removing all HTML. If we decide to change this to remove specific tags in future, we can use \IPS\Text\Parser::removeElements( $this->content() )
	 */
	public function truncated( $oneLine=FALSE, $length=500 )
  • Like 1
  • Upvote 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...