Skip to content

Commit

Permalink
Merge pull request #51 from Markus-GS/master
Browse files Browse the repository at this point in the history
SEO Title für Newsartikel
  • Loading branch information
Markus-GS authored Apr 1, 2020
2 parents 5567085 + 4846dac commit a5c88ad
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if ($news_id) {

$article_post = $newsmanager->getArticleById($news_id);

echo $article_post->getTitleTag($this->getValue('article_id'));
echo $article_post->getSEOTitleTag();
echo $article_post->getDescriptionTag();
echo $article_post->getCanonicalUrlTag($this->getValue('article_id'));
echo $article_post->getHrefLangTag ($article_post->getId());
Expand Down
1 change: 1 addition & 0 deletions lang/de_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ newsmanager_form_richtext = Artikel
newsmanager_form_status = Status
newsmanager_form_createdate = Datum
newsmanager_form_language = Sprache
newsmanager_form_seo_title = Meta Title
newsmanager_form_seo_description = Meta Description
newsmanager_form_seo_canonical = Canonical Link
newsmanager_form_category_select = Kategorie
Expand Down
1 change: 1 addition & 0 deletions lang/en_gb.lang
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ newsmanager_form_richtext = Article
newsmanager_form_status = Status
newsmanager_form_createdate = Date
newsmanager_form_language = Language
newsmanager_form_seo_title = Meta Title
newsmanager_form_seo_description = Meta descriptions
newsmanager_form_seo_canonical = Canonical link
newsmanager_form_category_select = Category
Expand Down
1 change: 1 addition & 0 deletions lang/es_es.lang
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ newsmanager_form_richtext = Artículo
newsmanager_form_status = Estado
newsmanager_form_createdate = Fecha
newsmanager_form_language = Idioma
newsmanager_form_seo_title = Meta Title
newsmanager_form_seo_description = Metadescripción
newsmanager_form_seo_canonical = Enlace canónico
newsmanager_form_category_select = Categoría
Expand Down
1 change: 1 addition & 0 deletions lang/sv_se.lang
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ newsmanager_form_richtext = Artikel
newsmanager_form_status = Status
newsmanager_form_createdate = Datum
newsmanager_form_language = Språk
newsmanager_form_seo_title = Meta Titel
newsmanager_form_seo_description = Meta Description
newsmanager_form_seo_canonical = Canonical Link
newsmanager_form_category_select = Kategori
Expand Down
1 change: 1 addition & 0 deletions lib/NewsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ private function initializeArticleObject($result, $lang_id)
// $newsArticle->setSubtitle($result->getValue('subtitle'));
$newsArticle->setRichtext($result->getValue('richtext'));
$newsArticle->setImages($result->getValue('images'));
$newsArticle->setSeo_title($result->getValue('seo_title'));
$newsArticle->setSeo_description($result->getValue('seo_description'));
$newsArticle->setSeo_canonical($result->getValue('seo_canonical'));
$newsArticle->setAuthor($result->getValue('author'));
Expand Down
31 changes: 31 additions & 0 deletions lib/NewsManagerArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class NewsManagerArticle
private $subtitle;
private $richtext;
private $images;
private $seo_title;
private $seo_description;
private $seo_canonical;
private $clang_id;
Expand Down Expand Up @@ -72,6 +73,11 @@ public function getImages()
return $this->images;
}

public function getSeo_title()
{
return $this->seo_title;
}

public function getSeo_description()
{
return $this->seo_description;
Expand Down Expand Up @@ -160,6 +166,12 @@ public function setImages($images)
$this->images = $images;
}

public function setSeo_title($seo_title)
{
$this->seo_title = $seo_title;
}


public function setSeo_description($seo_description)
{
$this->seo_description = $seo_description;
Expand Down Expand Up @@ -226,6 +238,13 @@ public function getTitleTag($article_id)
return '<title>' . htmlspecialchars($title) . '</title>'; // lang="de"
}


public function getSEOTitleTag()
{
return '<meta name="title" content="' . $this->getSeo_title() . '">';
}


public function getDescriptionTag()
{
return '<meta name="description" content="' . $this->getSeo_description() . '">';
Expand Down Expand Up @@ -310,4 +329,16 @@ public function printArticleTeaser($post, $singleViewArticleId)

return $output;
}

public function printArticleTeaserList($post, $newsArticle)
{
$output = '';
$suggestions = array('article-teaser-list');
$output .= $this->tpl->render($suggestions, array(
'title' => $post->getTitle(),
'subtitle' => $this->getSubtitle(),
'url' => $this->getUrl()
));
return $output;
}
}
2 changes: 1 addition & 1 deletion package.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Alle hier gesetzten Werte können über $addon->getProperty($key) abgefragt werden

package: newsmanager
version: '1.2.2'
version: '1.2.3'
author: Friends Of REDAXO
supportpage: https://github.com/FriendsOfREDAXO/newsmanager/

Expand Down
6 changes: 6 additions & 0 deletions pages/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function generateHelpTextMarkup ($form, $fieldName, $i18n_key_helptext) {
. '`subtitle`, '
. '`richtext`, '
. '`images`, '
. '`seo_title`, '
. '`seo_description`, '
. '`seo_canonical`, '
. '`author`, '
Expand All @@ -88,6 +89,7 @@ function generateHelpTextMarkup ($form, $fieldName, $i18n_key_helptext) {
. '`subtitle`, '
. '`richtext`, '
. '`images`, '
. '`seo_title`, '
. '`seo_description`, '
. '`seo_canonical`, '
. '`author`, '
Expand Down Expand Up @@ -270,6 +272,10 @@ function generateHelpTextMarkup ($form, $fieldName, $i18n_key_helptext) {

$field = $form->addFieldset('SEO Einstellungen');

$field = $form->addTextField('seo_title');
$field->setLabel(rex_i18n::msg('newsmanager_form_seo_title'));


$field = $form->addTextAreaField('seo_description');
$field->setLabel(rex_i18n::msg('newsmanager_form_seo_description'));

Expand Down
1 change: 1 addition & 0 deletions update.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
->ensureColumn(new rex_sql_column('subtitle', 'varchar(255)', false, ''))
->ensureColumn(new rex_sql_column('richtext', 'text', true))
->ensureColumn(new rex_sql_column('images', 'text', true))
->ensureColumn(new rex_sql_column('seo_title', 'varchar(255)', true))
->ensureColumn(new rex_sql_column('seo_description', 'varchar(255)', false, ''))
->ensureColumn(new rex_sql_column('seo_canonical', 'varchar(255)', true))
->ensureColumn(new rex_sql_column('clang_id', 'int(10)', true))
Expand Down

0 comments on commit a5c88ad

Please sign in to comment.