mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-21 04:14:24 +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()
|
analytics.init()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
module.run [
|
||||||
|
'$rootScope',
|
||||||
|
($rootScope) ->
|
||||||
|
$rootScope.$on '$stateChangeStart', (event, toState, toParams, fromState, fromParams) ->
|
||||||
|
$rootScope.description = ''
|
||||||
|
]
|
||||||
|
|
||||||
module.config [
|
module.config [
|
||||||
'$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider', '$httpProvider', '$sceDelegateProvider'
|
'$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider', '$httpProvider', '$sceDelegateProvider'
|
||||||
(location, state, $dialogProvider, analytics, $httpProvider, $sceDelegateProvider) ->
|
(location, state, $dialogProvider, analytics, $httpProvider, $sceDelegateProvider) ->
|
||||||
|
@ -283,4 +290,5 @@ module.config [
|
||||||
$dialogProvider.options
|
$dialogProvider.options
|
||||||
dialogFade: true
|
dialogFade: true
|
||||||
backdropClick: false
|
backdropClick: false
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,13 +21,14 @@ window.pfm.preloaders['album'] = [
|
||||||
]
|
]
|
||||||
|
|
||||||
angular.module('ponyfm').controller "album", [
|
angular.module('ponyfm').controller "album", [
|
||||||
'$scope', 'albums', '$state', 'playlists', 'auth', '$dialog', 'download-cached', '$window', '$timeout'
|
'$scope', '$rootScope', '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, cachedAlbum, $window, $timeout) ->
|
||||||
album = null
|
album = null
|
||||||
|
|
||||||
albums.fetch($state.params.id).done (albumResponse) ->
|
albums.fetch($state.params.id).done (albumResponse) ->
|
||||||
$scope.album = albumResponse.album
|
$scope.album = albumResponse.album
|
||||||
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 = []
|
$scope.playlists = []
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,14 @@ window.pfm.preloaders['playlist'] = [
|
||||||
]
|
]
|
||||||
|
|
||||||
angular.module('ponyfm').controller 'playlist', [
|
angular.module('ponyfm').controller 'playlist', [
|
||||||
'$scope', '$state', 'playlists', '$dialog', 'download-cached', '$window', '$timeout'
|
'$scope', '$rootScope', '$state', 'playlists', '$dialog', 'download-cached', '$window', '$timeout'
|
||||||
($scope, $state, playlists, $dialog, cachedPlaylist, $window, $timeout) ->
|
($scope, $rootScope, $state, playlists, $dialog, cachedPlaylist, $window, $timeout) ->
|
||||||
playlist = null
|
playlist = null
|
||||||
|
|
||||||
playlists.fetch($state.params.id).done (playlistResponse) ->
|
playlists.fetch($state.params.id).done (playlistResponse) ->
|
||||||
$scope.playlist = playlistResponse
|
$scope.playlist = playlistResponse
|
||||||
playlist = playlistResponse
|
playlist = playlistResponse
|
||||||
|
#$rootScope.description = "Listen to #{track.title} by #{track.user.name} on the largest pony music site"
|
||||||
|
|
||||||
$scope.share = () ->
|
$scope.share = () ->
|
||||||
dialog = $dialog.dialog
|
dialog = $dialog.dialog
|
||||||
|
|
|
@ -21,13 +21,14 @@ window.pfm.preloaders['track'] = [
|
||||||
]
|
]
|
||||||
|
|
||||||
angular.module('ponyfm').controller "track", [
|
angular.module('ponyfm').controller "track", [
|
||||||
'$scope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog', 'download-cached', '$window', '$timeout'
|
'$scope', '$rootScope', '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, cachedTrack, $window, $timeout) ->
|
||||||
track = null
|
track = null
|
||||||
|
|
||||||
tracks.fetch($state.params.id).done (trackResponse) ->
|
tracks.fetch($state.params.id).done (trackResponse) ->
|
||||||
$scope.track = trackResponse.track
|
$scope.track = trackResponse.track
|
||||||
track = trackResponse.track
|
track = trackResponse.track
|
||||||
|
$rootScope.description = "Listen to #{track.title} by #{track.user.name} on the largest pony music site"
|
||||||
|
|
||||||
$scope.playlists = []
|
$scope.playlists = []
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,18 @@
|
||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
--}}<!DOCTYPE html>
|
--}}<!DOCTYPE html>
|
||||||
<html>
|
<html ng-app="ponyfm">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
<title>Pony.fm</title>
|
<title>Pony.fm</title>
|
||||||
<meta name="description" content="" />
|
<meta name="description" content="@{{ description }}" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<base href="/" />
|
<base href="/" />
|
||||||
|
|
||||||
@yield('styles')
|
@yield('styles')
|
||||||
</head>
|
</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('content')
|
||||||
@yield('scripts')
|
@yield('scripts')
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue