Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a new configuration options to add HTML attributes to <title> #284

Merged
merged 3 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ jobs:
- "7.1"
- "7.2"
include:
- ruby-version: "2.7"
rails-version: "5.1"
- ruby-version: "2.7"
rails-version: "5.2"
- ruby-version: "3.2"
rails-version: "7.1"
code-coverage: true
Expand Down
16 changes: 4 additions & 12 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
# frozen_string_literal: true

appraise "rails-5.1" do
gem "railties", "5.1.7"
end

appraise "rails-5.2" do
gem "railties", "5.2.8.1"
end

appraise "rails-6.0" do
gem "railties", "6.0.6"
gem "railties", "~> 6.0.6"
end

appraise "rails-6.1" do
gem "railties", "6.1.7"
gem "railties", "~> 6.1.7"
end

appraise "rails-7.0" do
gem "railties", "7.0.4"
gem "railties", "~> 7.0.8"
end

appraise "rails-7.1" do
gem "railties", "7.1.0"
gem "railties", "~> 7.1.2"
end

appraise "rails-7.2" do
Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

## 2.20.0 (Development)

Features:

- Introduced `title_tag_attributes` configuration option to add HTML attributes to the title tag ([284](https://github.com/kpumuk/meta-tags/pull/284)).

Changes:

- Switched builds from CircleCI to Github Actions ([273](https://github.com/kpumuk/meta-tags/pull/273))

Changes:

- Ruby on Rails < 6.0 is no longer supported.

## 2.19.0 (October 5, 2023) [☰](https://github.com/kpumuk/meta-tags/compare/v2.18.0...v2.19.0)

Changes:
Expand Down Expand Up @@ -190,7 +198,7 @@ Features:

Changes:

- Rails < 3.2 is not longer supported
- Ruby on Rails < 3.2 is no longer supported

Features:

Expand All @@ -209,7 +217,7 @@ Bugfixes:

Changes:

- Ruby < 2.0 is not longer supported
- Ruby < 2.0 is no longer supported

Features:

Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Search Engine Optimization (SEO) plugin for Ruby on Rails applications.

## Ruby on Rails

The MetaTags main branch fully supports Ruby on Rails 5.1+ and is tested against all major Ruby on Rails releases.
The MetaTags main branch fully supports Ruby on Rails 6.0+ and is tested against all major Ruby on Rails releases.

> [!NOTE]
> We no longer support Ruby versions older than 2.7 and Ruby on Rails older than 5.1 since they reached their [End of Life](https://endoflife.date/ruby).
> We no longer support Ruby versions older than 2.7 and Ruby on Rails older than 6.0 since they reached their end of life (see [Ruby](https://endoflife.date/ruby) and [Ruby on Rails](https://endoflife.date/rails)).

## Installation

Expand Down Expand Up @@ -239,6 +239,24 @@ You will get this open graph meta tag automatically:

[Turbo](https://github.com/hotwired/turbo) is a simple solution for getting the performance benefits of a single-page application without the added complexity of a client-side JavaScript framework. MetaTags supports Turbo out of the box, so no configuration is necessary.

In order to update the page title, you can use the following trick. First, set the ID for the `<title>` HTML tag using MetaTags configuration in your initializer `config/initializers/meta_tags.rb`:

```ruby
MetaTags.configure do |config|
config.title_tag_attributes = {id: "page-title"}
end
````

Now in your turbo frame, you can update the title using a turbo stream:

```html
<turbo-frame ...>
<turbo-stream action="update" target="page-title">
<template>My new title</template>
</turbo-stream>
</turbo-frame>
```

### Using with pjax

[jQuery.pjax](https://github.com/defunkt/jquery-pjax) is a nice solution for navigation without a full-page reload. The main difference is that the layout file will not be rendered, so the page title will not change. To fix this, when using a page fragment, pjax will check the fragment DOM element for a `title` or `data-title` attribute and use any value it finds.
Expand Down
8 changes: 0 additions & 8 deletions gemfiles/rails_5.1.gemfile

This file was deleted.

204 changes: 0 additions & 204 deletions gemfiles/rails_5.1.gemfile.lock

This file was deleted.

8 changes: 0 additions & 8 deletions gemfiles/rails_5.2.gemfile

This file was deleted.

Loading