I've seen multiple ways to extract metadata from other web pages, but is there a simple way to extract my own page title, description, etc?
I want to store the metadata in a variable so that I can call to_query on it and put it in a link.
The title of a page is specified in its html; therefore it is impossible (ie impractical) to reference the title of a page directly from the page itself and use it to render more content to the page before serving it. You have two options:
2) Modify your rails application so that the title content is accessible anywhere in the view. (Recommended) This stackoverflow answer outlines an elegant way to create a title variable which can be used to set and access the title from anywhere in the view.
Note that in rails, the default title for each page is just the name of your rails app, and it's hardcoded into layouts/application.html.erb. So there really isn't much for you to "capture." If you want your pages to have unique titles, you need to program the back-end for that from scratch, as it were.