mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-16 18:14:23 +01:00
Proof-of-concept for SEO meta updates in angular #27
This commit is contained in:
parent
f09d75cf76
commit
1405ad7d31
5 changed files with 20 additions and 9 deletions
|
@ -25,6 +25,13 @@ if window.pfm.environment == 'production'
|
|||
analytics.init()
|
||||
]
|
||||
|
||||
module.run [
|
||||
'$rootScope',
|
||||
($rootScope) ->
|
||||
$rootScope.$on '$stateChangeStart', (event, toState, toParams, fromState, fromParams) ->
|
||||
$rootScope.description = ''
|
||||
]
|
||||
|
||||
module.config [
|
||||
'$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider', '$httpProvider', '$sceDelegateProvider'
|
||||
(location, state, $dialogProvider, analytics, $httpProvider, $sceDelegateProvider) ->
|
||||
|
@ -283,4 +290,5 @@ module.config [
|
|||
$dialogProvider.options
|
||||
dialogFade: true
|
||||
backdropClick: false
|
||||
|
||||
]
|
||||
|
|
|
@ -21,13 +21,14 @@ window.pfm.preloaders['album'] = [
|
|||
]
|
||||
|
||||
angular.module('ponyfm').controller "album", [
|
||||
'$scope', 'albums', '$state', 'playlists', 'auth', '$dialog', 'download-cached', '$window', '$timeout'
|
||||
($scope, albums, $state, playlists, auth, $dialog, cachedAlbum, $window, $timeout) ->
|
||||
'$scope', '$rootScope', 'albums', '$state', 'playlists', 'auth', '$dialog', 'download-cached', '$window', '$timeout'
|
||||
($scope, $rootScope, albums, $state, playlists, auth, $dialog, cachedAlbum, $window, $timeout) ->
|
||||
album = null
|
||||
|
||||
albums.fetch($state.params.id).done (albumResponse) ->
|
||||
$scope.album = albumResponse.album
|
||||
album = albumResponse.album
|
||||
$rootScope.description = "Listen to #{album.title}, the album by #{album.user.name}, and more on the largest pony music site."
|
||||
|
||||
$scope.playlists = []
|
||||
|
||||
|
|
|
@ -21,13 +21,14 @@ window.pfm.preloaders['playlist'] = [
|
|||
]
|
||||
|
||||
angular.module('ponyfm').controller 'playlist', [
|
||||
'$scope', '$state', 'playlists', '$dialog', 'download-cached', '$window', '$timeout'
|
||||
($scope, $state, playlists, $dialog, cachedPlaylist, $window, $timeout) ->
|
||||
'$scope', '$rootScope', '$state', 'playlists', '$dialog', 'download-cached', '$window', '$timeout'
|
||||
($scope, $rootScope, $state, playlists, $dialog, cachedPlaylist, $window, $timeout) ->
|
||||
playlist = null
|
||||
|
||||
playlists.fetch($state.params.id).done (playlistResponse) ->
|
||||
$scope.playlist = playlistResponse
|
||||
playlist = playlistResponse
|
||||
#$rootScope.description = "Listen to #{track.title} by #{track.user.name} on the largest pony music site"
|
||||
|
||||
$scope.share = () ->
|
||||
dialog = $dialog.dialog
|
||||
|
|
|
@ -21,13 +21,14 @@ window.pfm.preloaders['track'] = [
|
|||
]
|
||||
|
||||
angular.module('ponyfm').controller "track", [
|
||||
'$scope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog', 'download-cached', '$window', '$timeout'
|
||||
($scope, tracks, $state, playlists, auth, favourites, $dialog, cachedTrack, $window, $timeout) ->
|
||||
'$scope', '$rootScope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog', 'download-cached', '$window', '$timeout'
|
||||
($scope, $rootScope, tracks, $state, playlists, auth, favourites, $dialog, cachedTrack, $window, $timeout) ->
|
||||
track = null
|
||||
|
||||
tracks.fetch($state.params.id).done (trackResponse) ->
|
||||
$scope.track = trackResponse.track
|
||||
track = trackResponse.track
|
||||
$rootScope.description = "Listen to #{track.title} by #{track.user.name} on the largest pony music site"
|
||||
|
||||
$scope.playlists = []
|
||||
|
||||
|
|
|
@ -15,18 +15,18 @@
|
|||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--}}<!DOCTYPE html>
|
||||
<html>
|
||||
<html ng-app="ponyfm">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<title>Pony.fm</title>
|
||||
<meta name="description" content="" />
|
||||
<meta name="description" content="@{{ description }}" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<base href="/" />
|
||||
|
||||
@yield('styles')
|
||||
</head>
|
||||
<body ng-app="ponyfm" ng-controller="application" class="{{Auth::check() ? 'is-logged' : ''}}">
|
||||
<body ng-controller="application" class="{{Auth::check() ? 'is-logged' : ''}}">
|
||||
@yield('content')
|
||||
@yield('scripts')
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue